Using MS-ADO in VC++
Posted on 2001-08-27
I have been trying to use ADO inside a C++ win32 static DLL but am having no luck. Almost all the documentation says the same thing: type in this #import "..... msado15.dll" and then they just stop explaining, like something magical is supposed to happen after that. I am putting this #import directive inside "stdafx.h". I build the DLL successfully, but I was under the impression that some classes were supposed to be generated in my project file based on the ADO dll. I am not sure when to use, for example, _Recordset or _RecordsetPtr. I am looking at sample code from a MS KB article that does something like this: (notice the dot on the first one and the pointer reference on the second one... and their sample code compiles and runs!)....
rs.CreateInstance( __uuidof( Recordset ) );
rs->Open("select * from myTable", "myDSN", adOpenStatic,adLockBatchOptimistic,-1);
By the way, I am getting a linker error on the "open" call:
rs->Open("select * from myTable", "myDSN", adOpenForwardOnly, adLockOptimistic, adCmdText);
I know I am just not doing something right. Any help is greatly appreciated!! Thank you.