SqlConnection conn = new SqlConnection(ConnectionString); String S = "Insert into Area values ('" + textBox1.Text.ToString().Trim() + "')"; SqlCommand command = new SqlCommand(S); SqlDataAdapter da = new SqlDataAdapter(S,ConnectionString); // DataSet dt = new DataSet(); DataTable dt = new DataTable(); da.Fill(dt); textBox1.Clear(); listBox1.Items.Add(dt.Rows[0].ItemArray[0].ToString());
SqlCommand command = new SqlCommand(sqlQuery, conn); conn.Open(); command.ExecuteNonQuery(); conn.Close(); //After Inserting value into database add the value to the list box, THEN clear the text box listBox1.Items.Add(textBox1.Text.Trim()); textBox1.Clear();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)