How can I add data into a SQL Server Express database?
I have written the following code
SqlConnection conn = new SqlConnection();
conn.ConnectionString = @"Data Source=.\SQLExpress;"
+"User Instance=true;" + "Integrated Security=true;"
+ "AttachDbFilename=|DataDirectory|GCdatabase.mdf;";
conn.Open();
//...
conn.Close();
Is this right?
If yes then how can I add data into table ?
There are several ways of doing that. One of them is using a
SqlCommandobject with aninsertSQL statement: