SqlCommand cmd = new SqlCommand("commandText,con"); // here commandtext is your query or name of the procedure that will return the Rows and con is a SqlConnection object con.Open(); SqlDataReader dr = cmd.ExecuteReader(); while(dr.Read()) { ListViewItem obj=new ListViewItem(Convert.ToString(dr[0]),Convert.ToString(dr[1]); //in object of ListViewItem give display member at first and give value member at second position listView1.Items.Add(obj); // add object to the listbox } con.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)