首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

更新数据库,该如何处理

2012-02-15 
更新数据库string value dataGridView1.CurrentCell.Value.ToString()string time DateTime.Now.ToSt

更新数据库
string value = dataGridView1.CurrentCell.Value.ToString();
string time = DateTime.Now.ToString();
command.CommandText = "update Table_Guest set LeaveTime='"+time+"'and State='离开' where GuestID="+value;
command.ExecuteNonQuery();
我要将列LeaveTime和State的值更新,调试时报错,显示语法错误,问一下上面的语法哪个地方出错了,谢谢指教!

[解决办法]
command.CommandText = "update Table_Guest set LeaveTime='"+time+"', State='离开' where GuestID="+value;


and 改為,
就可以了
如:update xx set y=1,z=2 where x=3

热点排行