VC 6访问ACCESS数据库问题
在初始化时提示:Open database error!(3) UnKnown error 0x800A0E81
单步调试在运行至:m_pCommand->ActiveConnection = pConnection;时发生异常.
C/C++ code:
CString strSqlConnText;
_ConnectionPtr pConnection;
_RecordsetPtr m_pRecordset;
_CommandPtr m_pCommand;
BOOL CPXESER::InitDataBase(CString strDBName)
{
TCHAR szFilePath[MAX_PATH + 1];
GetModuleFileName(NULL, szFilePath, MAX_PATH);
(_tcsrchr(szFilePath, _T('\\')))[1] = 0;
strSqlConnText.Format(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s%s;Mode=ReadWrite|Share Deny None;Persist Security Info=False"),szFilePath,strDBName);
if(!AfxOleInit())
{
AfxMessageBox("Initialize OLEDB Library error!");
return false;
}
pConnection.CreateInstance(__uuidof(Connection));
m_pCommand.CreateInstance(__uuidof(Command));
m_pRecordset.CreateInstance(__uuidof(Recordset));
try
{
pConnection->CursorLocation = adUseClient;
pConnection->Open((_bstr_t)strSqlConnText,"","",adModeShareDenyNone);
}
catch(_com_error e)
{
CString strTemp="";
strTemp.Format("Open database error!(1)\r\nError Message:%s",e.ErrorMessage());
AfxMessageBox(strTemp);
return false;
}
catch (CExcept
相关问答:
Dbgrid连接access 显示数据时拖动滚动条死机?怎么解决啊?
机器太差了吧?
是不是你数据量太大了啊
你数据少一些看看还死机吗?
数据很少啊 就一页。
我在BCB6下做过不少 DBGRID+ACCESS ,从来没有遇到 ......
最近学习asp,当练习到连接数据库的时候,频频出错,可就是不知道错在怎么地方,请高手帮忙看看!!谢谢!
包含文件xx.asp、xxsave.asp、conn.asp以及student1.mdb和表xxgl……
xx.asp为:
<html>
<hea ......
问题1
我用ADO连接设了用户名密码的数据库
但是我发现我不输入 用户名和密码 都可以连接成功 而且还能把数据读出来
剪了一个名为test数据库 建了一个名为people的表
见了一个 用户名1234 密码1234 的 ......
各位高手好,麻烦帮我看下这个数据库连接问题:
做了一个BBS但是数据库就是连接不上。错误代码如下
HTTP Status 500 -
------------------------------------------------------------------------------- ......