CString a;
a.Format("update CardInfo set LeaveMoney=LeaveMoney+'%s' where CardId='%s'",m_Count,m_CardId);ADO连接数据库,这句想实现的功能是:输入m_CardId、m_Count,在表CardInfo中让LeaveMoney加上m_Count,但是m_Count不是表中的字段。 在运行的时候报错请问该怎样写这个语句。
a.Format("update CardInfo set LeaveMoney=LeaveMoney+'%s' where CardId='%s'",m_Count,m_CardId);ADO连接数据库,这句想实现的功能是:输入m_CardId、m_Count,在表CardInfo中让LeaveMoney加上m_Count,但是m_Count不是表中的字段。 在运行的时候报错请问该怎样写这个语句。
如果LeaveMoney类型是money 该怎么改这句?
如果LeaveMoney类型是char 呢?
a.Format("update CardInfo set LeaveMoney=LeaveMoney+'%s' where CardId='%s'",m_Count,m_CardId);当LeaveMoney为char 、m_Count为CString时,运行程序还是要报错 ,大哥帮看哈嘛 ,怎么改啊?该怎么写这个语句啊?
m_Rst.CreateInstance(__uuidof(Recordset));
CString a;
a.Format("update CardInfo set LeaveMoney=LeaveMoney+'%s' where CardId='%s'",m_Count,m_CardId);
try
{
m_Rst->Open(_variant_t(a),
conn.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
}
catch(_com_error *es)
{
AfxMessageBox(es->ErrorMessage());
}
整个语句就这样。路论上没有错,但是在运行的时候要报错。
如果我把那条SQL语句换成a.Format("update CardInfo set LeaveMoney=LeaveMoney+100 where CardId='%s'",m_CardId); 则可以运行。 到底该怎么改啊???大哥些。