连接字符串 = @"Data Source=LocalHost\服务器名;Initial Catalog=数据库名 ;Integrated Security=True";
SqlConnection con = new SqlConnection(连接字符串);
string ss = “sql语句”;
SqlCommand com = new SqlCommand(ss, con);
con.Open();
com.ExecuteNonQuery();
con.Close();
然后再加入SQL语句“insert into 表(字段名,字段名,字段名......) values(‘相应数据’,‘相应数据’.....)”就行了,记住:标点符号一定要是英文状态下的才行
连接字符串 = @"Data Source=LocalHost\服务器名;Initial Catalog=数据库名 ;Integrated Security=True";
SqlConnection con = new SqlConnection(连接字符串);
string ss = “sql语句”;
SqlCommand com = new SqlCommand(ss, con);
con.Open();
com.ExecuteNonQuery();
con.Close();