I am trying to add data from sql in string list but it keeps saynig that my string list = null.
code on the button:
    protected void Button2_Click(object sender, EventArgs e)
        {
            // go back to the menu
        }
        protected void Button3_Click(object sender, EventArgs e)
        {
            // code to display the books by sanctuary
            ListBox1.Items.Clear();
            List<String> s = DBConnectivity.LoadBooksBySanctuary2(3/*int.Parse(DDSanctuary.SelectedValue)*/);
            foreach (var detail in s)
            {
               ListBox1.Items.Add(detail);
            }
        }
code to read from SQL and put into string list. I know my connection works fine because I can add pets
 public static List<String> LoadPetsBySanctuary2(int sID)
        {
            List<String> saName = new List<String>();
            SqlConnection myConnection = GetConnection();
            // string myQuery = "SELECT  Name, categId, cName FROM Book, Category WHERE Book.CategID=Category.ID AND Book.authorId = " + sID;
            string myQuery = "SELECT  Name  FROM pet WHERE sanID = " + saName;
            SqlCommand myCommand = new SqlCommand(myQuery, myConnection);
            try
            {
                myConnection.Open();
                SqlDataReader myReader = myCommand.ExecuteReader();
                while (myReader.Read())
                {
                 //   saName.Add(myReader["Name"].ToString());
                    saName.Add(myReader["Name"].ToString());
                }
                return saName;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in DBHandler", ex);
                return null;
            }
            finally
            {
                myConnection.Close();
            }
        }
 
     
    