Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

#import "msado10.dll" in VC 5.0 & ADO

53 views
Skip to first unread message

Scott Cranton

unread,
Mar 28, 1997, 3:00:00 AM3/28/97
to

Robert,

#import by default wraps the interface definations in namespace <typelib
name>. To by pass this, like Gerry, you need to add the no_namespace
attribute or qualify your pointer with <typelib name>::_ConnectionPtr pSet

Hope this helps,

Scott


Robert Ricardo

unread,
Mar 28, 1997, 3:00:00 AM3/28/97
to

I am using the new #import in VC 5.0 on the ActiveDataObjects here is my
code:

#import "c:\Program Files\Common Files\System\ADO\msado10.dll"
rename("EOF","A_EOF")

This build the wrapper functions in a TypeLib header file.

the problem occurs when I go to use a function in ADO now like this:

HRESULT hr;
_ConnectionPtr pSet;

hr = pSet.CreateInstance(__uuidof(Connection));
if(FAILED(hr)
return hr;


hr = pSet->Open("DSN=MDI15;SRVR=MDI15;UID=TDA0150;PWD=transfer");
if(FAILED)(hr))
return hr;

The _ConnectionPtr pSet lines gives me a compiler error because it is
undefined.

But it is define in the TypeLibHeader file built from the #import shown
above. If you
look in the header file you will see the struct _ConnectionPtr. The real
problem
is that all of the TypeLib Header files are created by the compiler but it
isn't integrating into my project because I am getting basic errors of
undefined type.
I think I will go back to the old way of using this object unless someone
has run
accross this problem.

Robert Ricardo
rric...@techdata.com
rob...@activehost.com

Gerry High

unread,
Mar 28, 1997, 3:00:00 AM3/28/97
to

Here is my code sample code that works:

#import "D:\Program Files\Common Files\System\ADO\MSADO10.DLL" no_namespace
...
_RecordsetPtr rs("ADODB.Recordset");
rs->Open("exec spListing_GetActive",
"DRIVER={SQL Server};SERVER=atlas;UID=sa;pwd=xxxx;APP=Microsoft (R)
Developer Studio;WSID=GHIGHLT;LANGUAGE=us_english;DATABASE=Voyager",
adOpenKeyset,
adLockReadOnly,
adCmdUnspecified);
rs->MoveFirst();
rs->MoveLast();
*count = rs->GetRecordCount();

Gerry High
gh...@empower.com
====================
Robert Ricardo <rob...@activehost.com> wrote in article
<01bc3ba6$d34d7510$6c0599a9@rricardo-nt>...

0 new messages