Fog Creek Software
Discussion Board

Connection Strings

Sorry to ask -again- ... but ...

//Code Snippet
BOOL m_bIsValid;
MSADO::_ConnectionPtr m_Database;


CString strDB = _T("C:\\Test\\Test.mdb");
const _bstr_t DSN = L"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + strDB;
if (FAILED(hr = m_Database->Open(DSN, "", "", NULL)))
-- Doesn't seem to be working on a WinNT machine.  I allready installed MDAC 2.5 and JET 4.0SP3.  Any ideas?

oh, here's how I imported ADO:

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
    rename("EOF", "EndOfFile") rename_namespace("MSADO")


Matt H.
Thursday, January 23, 2003


I'm looking for a connection string so that I -won't- have to install MDAC and JET 4.0 on a NT4 or Win98 box.

After re-booting, I managed to get it to work with MDAC and Jet.  I'd like to avoid all those pre-requisits.


Matt H.
Thursday, January 23, 2003

I'm not sure you can.

Sometime between MDAC 2.1 and MDAC 2.5 some of the IIDs for things like _Connection and _Recordset got changed. I assume you've got a post 2.5 version of MDAC on your dev PC, in which case #import is going to generate the newer IIDs from that.

Then when you stick it on a 98 or NT PC, with an earlier version of MDAC, CoCreateInstance looks in the registry for the various IIDs specified in your code, can't find them (because they don't exist) and barfs.

I think you've just got to force an upgrade to 2.5 if they've got anything earlier. (On my system here I've got a small DLL which #imports the type libraries for MDAC 2.0, 2.1, 2.5 and 2.6 and checks whether or not it can create a pointer to _Connection on each one. If it can't handle 2.5 or 2.6 it will force an upgrade).

Better than being unemployed...
Friday, January 24, 2003

Oh, and exactly what sort of error are you getting, and where?

Better than being unemployed...
Friday, January 24, 2003

*  Recent Topics

*  Fog Creek Home