asp.net将数据插入数据库的问题?
下面是某个按钮里面的事件代码,就是插入一条数据而已,错在哪里??stringconn="Server=.;InitialCatalog=test;uid=sa;pwd=1...
下面是某个按钮里面的事件代码,就是插入一条数据而已,错在哪里??
string conn = "Server =.; Initial Catalog =test; uid = sa; pwd =12345asdfg";
SqlConnection Myconn = new SqlConnection(conn);
Myconn.Open();
string a = "insert into test(userID,userName,content) values('110704105','12:12:12','nothing')";
SqlCommand comm = new SqlCommand(a, Myconn);
comm.CommandType = CommandType.Text;
comm.ExecuteNonQuery();
Myconn.Close(); 展开
string conn = "Server =.; Initial Catalog =test; uid = sa; pwd =12345asdfg";
SqlConnection Myconn = new SqlConnection(conn);
Myconn.Open();
string a = "insert into test(userID,userName,content) values('110704105','12:12:12','nothing')";
SqlCommand comm = new SqlCommand(a, Myconn);
comm.CommandType = CommandType.Text;
comm.ExecuteNonQuery();
Myconn.Close(); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询