VC++数据库更新

sunhuang25455 2010-11-06 10:01:30
try
{strSQL.Format("select count(*) as name from datatable where pusername=%s and starTime=%s ",dusername,startime);
_variant_t m_pRecordset2,var;
m_pConnection->CursorLocation = adUseClient;
m_pRecordset=m_pConnection->Execute(_bstr_t(strSQL), &m_pRecordset2, adCmdText);
var=m_pRecordset->GetCollect((_variant_t)((long)0));
if(var.lVal!=0)
{
_variant_t var2;
strSQL1.Format("update datatable set stopTime='%s',sendByet='%s' where pusername=%S and starTime=%s",endtime,sendb,dusername,startime);
m_pConnection->CursorLocation = adUseClient;
m_pConnection->Execute(_bstr_t(strSQL1), &var2, adCmdText);
m_pRecordset->Update();
m_pRecordset->Close();
}
else
{

}
我很菜的啊。我想更具数据库里的内容进行更新,如果有记录就更新。请大侠帮忙看看啊!
...全文
157 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

70,020

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧