ADO向ACCESS数据库插入数据问题,救急
m_Price是float型
m_Month是ctime型
其它是cstring型
错误提示:弹出错误对话框,×××.exe-应用程序错误,………………该内存不能为"read"
高手急救~~~~到底应该如何写
C/C++ code:
void CDailyAccountDlg::OnAdd()
{
UpdateData();
CString sql;
CoInitialize(NULL);
_ConnectionPtr pCon(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
try
{
pCon->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=dailyAccount.mdb", "", "", adConnectUnspecified);
try
{
sql.Format("insert into daily(category,event,price,describe,date)values('%s','%s','%d','%s',#%s#)",csg_Category,csg_Event,m_Price,m_Desc,m_Month);
pRst->Open((_bstr_t)sql, _variant_t((IDispatch*)pCon), adOpenDynamic, adLockUnspecified, adCmdText);
}
catch(_com_error e)
{
AfxMessageBox("数据插入失败!");
}
}
catch(_com_error e)
{
AfxMessageBox("数据库连接失败!");
}
pRst->Close();
pCon->Close();
pRst.Release();
pCon.Release();
CoUninitialize();
}
你catch的时候就不能把错误信息显示出来吗?
C/C++ code
Code highlighting pro
相关问答:
IsSqlDataBase = 0 '主数据库类型(1=SQL,0=AC)
'===========================================================================
SqlDatabaseName = "ads365" '主数据库名
S ......
access 中执行sql update语句时有时候成功有时候不成功,但是access中不出错误信息,不知道是什么原因,有哪位大侠知道,请帮忙啊
贴SQL语句,检查表、字段的有效性设置
sql 在查询分析器里面 执行很正常
是 ......
_RecordsetPtr CMyAdo::SelectRecord(string &where, string &tablename,string &field, int way )
{
int ret = 0;
_RecordsetPtr pset;
CString sql;
& ......
ACCESS数据库中有一个tablename表,设计如下
编号,书名,作者,出版时间,出版社,ISBN,目录,简介
其中除“编号”为自动编号外,其它都为“备注”
其中"编号"维一,在“ISBN”中有的为空值, ......
如何把access数据库的内容导出到work文档中进行编辑打印?谢谢
如何用VB编写程序实现把access数据库的内容导出到work文档中进行编辑打印?
新建的Word和已有的Word的代码肯定是不一样的
这点LZ还需要指明
......