sibotho 0 Light Poster

Hi

I have a database with a Contacts table, in this table I have 2 columns emailAdd and byEmail. I want to select emailAdd where byEmail = Y and add these selected items into a Listbox.

Please help how do i do this

this is what I tried but does not work.

SqlDataSource notify = new SqlDataSource();
        notify.ConnectionString = ConfigurationManager.ConnectionStrings["procurementConnectionString5"].ToString();
        
        notify.SelectCommandType = SqlDataSourceCommandType.Text;
        notify.SelectCommand = "SELECT emailAdd FROM ContactDetails WHERE byEmail LIKE 'Y'";  //not sure about this line as well                             

        string []item = {notify.SelectParameters.ToString()}; // I think the problem is with this line

        foreach (string ss in item)
        {
            //ListBox1.DataBind();
            ListBox1.Items.Add(ss);
          
        }