我想知道为什么这段代码不起作用?
SqlCommand comand = new SqlCommand();
//string myConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=try;Integrated Security=True;Pooling=False";
SqlConnection conn = new SqlConnection(@"server=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\mydatabase.mdf;Integrated Security=True;User Instance=True");
comand.Connection = conn;
conn.Open();
comand.CommandText = "INSERT INTO TableProduct (productID,productName) VALUES ('1','M')";
comand.ExecuteNonQuery();
conn.Close();