","附近有语法错误. 这个插入语句应该没错啊,为什么一打开表要添加就报错。。。
privatevoidForm1_Load(objectsender,EventArgse){stringconnectionString="server=.;datab...
private void Form1_Load(object sender, EventArgs e)
{
string connectionString = "server=.;database=StuApart;integrated security=true";
SqlConnection conn3 = new SqlConnection(connectionString);
conn3.Open();
string conn2 = "insert into Student (Name,No,Sex,Class,ApartNo,DormiNo,DepartName) values('张三','141101','男','计科1141','204','23','信统')";
SqlCommand cmd = new SqlCommand(conn2, conn3);
cmd.ExecuteNonQuery();
conn3.Close();
} 展开
{
string connectionString = "server=.;database=StuApart;integrated security=true";
SqlConnection conn3 = new SqlConnection(connectionString);
conn3.Open();
string conn2 = "insert into Student (Name,No,Sex,Class,ApartNo,DormiNo,DepartName) values('张三','141101','男','计科1141','204','23','信统')";
SqlCommand cmd = new SqlCommand(conn2, conn3);
cmd.ExecuteNonQuery();
conn3.Close();
} 展开
2个回答
2016-05-26
展开全部
该不是写成中文的逗号了吧?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询