Hers your answer with the baked code,
Explanation: Here on the page load i have added the data from the database into the listbox.
private void Update_Existing_Load(object sender, EventArgs e)
{
listBox1.Items.Clear();
using (SqlConnection con = new SqlConnection())
{
con.ConnectionString = "Data Source=.;Initial Catalog=phonebook;Integrated Security=True";
con.Open();
string query = "select FirstName+' '+LastName from Details";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read() == true)
{
listBox1.Items.Add(dr[0].ToString());
}
con.Close();
con.Dispose();
}
}
Do rate my answer once you find it useful
Thanks & Regards
Radix :rose: