日期:2014-05-18  浏览次数:20707 次

更新数据库
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