Question

whats wrong with this code when i am trying to populate data into checkboxlist from database using layered architecture. the data doesn't come up

 protected void FillCheckBoxList()
{
    if (CheckBoxList1.Items.Count> 0)
    {
        CheckBoxList1.Items.Clear();
    }
    DataSet ds1 = new DataSet();
    ds1 = bll.def_ReturnEnquiry();
    if (ds1.Tables[0].Rows.Count > 0)
    {
        //ListItem li = new ListItem();
        //li.Value = "";
        //li.Text = "<---Select Enquiry--->";
        //li.Selected = true;
        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
        {
            ListItem li1 = new ListItem();
            li1.Value=ds1.Tables[0].Rows[i][1].ToString();
            li1.Text=ds1.Tables[0].Rows[i][0].ToString()+" / "+ds1.Tables[0].Rows[i][3].ToString()+" / "+ds1.Tables[0].Rows[i][1].ToString();
            CheckBoxList1.Items.Add(li1);
        }
    }
}

// business logic layer function
public DataSet def_ReturnEnquiry()
    {
        return dll.ReturnTable("select * from studentinfo where emp_id=NULL");
    }
Was it helpful?

Solution

Got the answer: here

the query should be

select * from student_info where emp_id is NUll
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top