string connectionString =@”Data Source=(local);Initial Catalog=book;User ID=sa;Password=123″;
SqlConnection myConnection = new SqlConnection(connectionString);
myConnection.Open();
SqlCommand cmd = new SqlCommand(“insert into RFID(ID) values(“ref IsoBuf”)”,myConnection);
cmd.ExecuteNonQuery();
myConnection.Close();
SqlConnection myConnection = new SqlConnection(connectionString);
myConnection.Open();
SqlCommand cmd = new SqlCommand(“insert into RFID(ID) values(“ref IsoBuf”)”,myConnection);
cmd.ExecuteNonQuery();
myConnection.Close();
解决方案
10
你操作的什么数据库?本人试了下sqlserver没有问题呀
10
打个断点调试一下,看看里面具体的错误,感觉你这没什么问题
10
感觉你用的不是sqlServer数据库
10
你的sqlcommand的Connection不用赋值的吗?cmd.Connection=myConnection ;