This code adds an entry to the database, this is displayed in the 'DataGridView'. But, if you open the database itself, the added rows do not appear in it. After a while or the restart of the studio, the added rows are no longer displayed in the 'DataGridView'. How to write the lines in the database itself, so that they do not disappear?
SqlConnection connection; string connectionString = ConfigurationManager.ConnectionStrings["DataBases2.Properties.Settings.Database1ConnectionString"].ConnectionString; string query = "INSERT INTO Users VALUES (@userName, @userAge)"; using (connection = new SqlConnection(connectionString)) using (SqlCommand command = new SqlCommand(query, connection)) { connection.Open(); command.Parameters.AddWithValue("@userName", tbName.Text); command.Parameters.AddWithValue("@userAge", tbAge.Text); command.ExecuteNonQuery(); connection.Close(); }