返回信息流这是一个在系统里修改密码的函数,这里的strsql语句是不是写的不对啊?open语句报错了……
try
{
CString strsql;
m_pRs.CreateInstance("ADODB.Recordset");
strsql.Format(_T("update Login set PassWord='%s' where PassWord='%s'" ),m_newPswString,m_oldPswString);
HRESULT hr=m_pRs->Open(_variant_t(strsql),(m_pConn.GetInterfacePtr()),adOpenStatic,adLockOptimistic,adCmdText);
MessageBox(_T("修改成功!"),_T("提示"),MB_OK);
}
catch(_com_error e)
{
AfxMessageBox(e.ErrorMessage()+e.Description());
}
如果try语句写成:
m_pRs.CreateInstance("ADODB.Recordset");
CString strsql;
strsql.Format(_T("SELECT * FROM Login where PassWord='%s'"),m_oldPswString);
HRESULT hr=m_pRs->Open(_variant_t(strsql),(m_pConn.GetInterfacePtr()),adOpenStatic,adLockOptimistic,adCmdText);
m_oldPswString=m_newPswString;
m_pRs->PutCollect("PassWord",(_variant_t)m_oldPswString);
MessageBox(_T("修改成功!"),_T("提示"),MB_OK);
这样编译没问题可是写不到数据库里,这种问题怎么解决啊?请教……
这是一条镜像帖。来源:北邮人论坛 / database / #5775同步于 2011/7/10
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Database机器人发帖
access数据库更新问题
heshanshan
2011/7/10镜像同步1 回复
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复