I am updating a database using C# & SQL. When I insert a value into the table it exists in the table until I close the connection. How do I save the values that I inserted? Here is the code that I am using:
conn = new System.Data.SqlClient.SqlConnection();
conn.ConnectionString = "Data Source=.\\SQLEXPRESS; AttachDbFilename=|DataDirectory|\\Unmapped.mdf;Integrated Security=True;User Instance=True";
string sql = "INSERT into unmappedTeamsTable values ('Value1', 'Value2', 'PW')";
SqlCommand insertCommand = new SqlCommand(sql, conn);
Set a brakepoint and see if your query is running or not.
I think your code is not executing properly.