hr = m_pConnection.CreateInstance("ADODB.Connection");
if (SUCCEEDED(hr))
{
if (FAILED(m_pConnection->Open("Provider = sqloledb;Server=(local);Database=c863;Trusted_Connection=yes","","",-1)))
{
AfxMessageBox("Can not open Database!");
m_pConnection.Release();
return FALSE;
}
}
when i debug ,there is an exception at "m_pConnection->Open("Provider = sqloledb;Server=(local);Database=c863;Trusted_Connection=yes","","",-1)))"
the exception is
'Book.exe': Loaded 'C:\Program Files\Common Files\System\Ole DB\sqloledb.rll', Binary was not built with debug information.
First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4..
how should i do?
Server=(local)\SQLEXPRESS
SQL Express is installed as a "named" instance by default, an drequires the instance name specification when making a connection (as opposed to a "default" instance).|||Sorry,it dont still work.the exception is
"First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4.."|||It looks like the failure may be unrelated to your connection string.
>> First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4.
Try running your application with a debugger attached and breaking at the point the exception occurs. This will likely give you more insight into the cause of the problem.
Hope this helps,
Vaughn
No comments:
Post a Comment