Connection->Execute()不能使用update 语句么解决方法
Connection->Execute()不能使用update 语句么
tb_conn-> Execute(_bstr_t(strsql),0,0);没有包错 也没有更改数据库内容
但是我在查询分析器里 执行strsql语句是对得 是不是我后面2个参数写错了
不应该是 "0,0 "????
------解决方案--------------------
//操作数据库的三个主要函数,使用前要初始化好m_pConnection
//数据库的更新
bool CTestMenuDlg::DbUpdata(CString sql)
{
_variant_t RecordsAffected;
try
{
m_pConnection-> Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
}
catch(_com_error e)///捕捉异常
{
return false;
}
return true;
}
tb_conn-> Execute(_bstr_t(strsql),0,0);没有包错 也没有更改数据库内容
但是我在查询分析器里 执行strsql语句是对得 是不是我后面2个参数写错了
不应该是 "0,0 "????
------解决方案--------------------
//操作数据库的三个主要函数,使用前要初始化好m_pConnection
//数据库的更新
bool CTestMenuDlg::DbUpdata(CString sql)
{
_variant_t RecordsAffected;
try
{
m_pConnection-> Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
}
catch(_com_error e)///捕捉异常
{
return false;
}
return true;
}