Generation

generate functionSun, 04 Dec 2022

print to a listbox all the data from a SQL database table

. . . String query = "select * from table"; cmd = new SqlCommand(query, con); con.Open(); reader = cmd.ExecuteReader(); List<String> data = new List<String>(); while(reader.Read()) { data.Add(reader["column"].ToString()); } listbox.DataSource = data; con.Close();

Questions about programming?Chat with your personal AI assistant