asp.net数据库操作技术问题,SqlCommand.ExecuteNonQuery(),执行UPDATA更新语句不了,为什么?代码如下:
//C#,执行插入与删除都可以,就是UPDATA不行!!!//删除语句stringstrCommand="DELETEFROMNewsTableWHEREID="+ID;...
//C#,执行插入与删除都可以,就是UPDATA不行!!!
//删除语句 string strCommand = "DELETE FROM NewsTable WHERE ID ="+ID;
//插入语句 string strCommand = "INSERT INTO NewsTabl (NewsTitle,NewsContent,Remark,Time VALUES"+ "('" + Title + "','" + Content + "','" + Remark + "','"+Time+"')";
string strCommand = "UPDATA NewsTable SET NewsTitle='例子' WHERE ID=20";
SqlCommand com = new SqlCommand(strCommand, m_sqlC);
if (m_sqlC.State == System.Data.ConnectionState.Closed)
m_sqlC.Open();
com.ExecuteNonQuery();//到此就出错!
m_sqlC.Close(); 展开
//删除语句 string strCommand = "DELETE FROM NewsTable WHERE ID ="+ID;
//插入语句 string strCommand = "INSERT INTO NewsTabl (NewsTitle,NewsContent,Remark,Time VALUES"+ "('" + Title + "','" + Content + "','" + Remark + "','"+Time+"')";
string strCommand = "UPDATA NewsTable SET NewsTitle='例子' WHERE ID=20";
SqlCommand com = new SqlCommand(strCommand, m_sqlC);
if (m_sqlC.State == System.Data.ConnectionState.Closed)
m_sqlC.Open();
com.ExecuteNonQuery();//到此就出错!
m_sqlC.Close(); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询