I have 4 list boxes and I have a DB as EMP with table tab1 and columns Name,EmpId, Salary …
So I want to display salary in one of the list boxes. How do I do it???
SqlConnection con = new SqlConnection(connec);
string insert_query = "select Salary from tab1";
con.Open();
try
{
SqlCommand cmd = new SqlCommand(insert_query, con);
int exe = cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ListBox3.DataSource = ds;
ListBox3.DataBind();
}
Is this the way? I have some problems like the items are not been displayed in the list boxes.
you need to specify this before.