string conString = @"data source=.\SQLEXPRESS;Database=XXXX_database;User Id=sa;Pwd=123456";
using (SqlConnection connection = new SqlConnection(conString))
{
try
{
connection.Open();
string strSQL = "Update MainTable Set State = '0' where ID = '201'";
SqlCommand sqlcom = new SqlCommand(strSQL, connection);
}
catch (System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
}
在SQL Server Management Studio上运行修改成功,用C#进行修改则不行,查询语言也可以查询成功。
高手相助,本人为这个要抓狂了~c#数据库SQLUpdate
using (SqlConnection connection = new SqlConnection(conString))
{
try
{
connection.Open();
string strSQL = "Update MainTable Set State = '0' where ID = '201'";
SqlCommand sqlcom = new SqlCommand(strSQL, connection);
}
catch (System.Data.SqlClient.SqlException ex)
{
throw new Exception(ex.Message);
}
}
在SQL Server Management Studio上运行修改成功,用C#进行修改则不行,查询语言也可以查询成功。
高手相助,本人为这个要抓狂了~c#数据库SQLUpdate
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货