cant load msado.tlh

Mar 21, 2011 at 11:58am
I cant seem to make this statement work in a header file :

#import "msado15.dll"

Ive also tried the full path to msado.dll. Ive tried to clean the solution and full recompile. I looked in the target path and msado.tlh isnt getting generated.

The error is:

IntelliSense: cannot open source file "c:/Users/john smith/documents/visual studio 2010/Projects/try7db/try7db/Debug/msado15.tlh" c:\users\john smith\documents\visual studio 2010\projects\try7db\try7db\database.h

can someone tell me what Im doing wrong?

btw my ultimate goal is to connect/read/write to an existing SLQCE database.

Thanks in advance for any help!
Last edited on Mar 21, 2011 at 11:59am
Mar 21, 2011 at 2:03pm
You should import the tlb, not the dll.
Mar 21, 2011 at 5:00pm
Thanks kbw,

I've seen the import exactly the way Ive written it in a couple of examples on the web. Also there exists no msado.tlb inside "c:\Program Files (x86)\Common Files\System\ADO" I tried to import "c:\Program Files (x86)\Common Files\System\ADO\msado28.tlb" and got the same type of error complaining about a tlh file.

For awhile today "#import c:\Program Files (x86)\Common Files\System\ADO\msado.dll" was working and it even had generated a msadodll.tlh that I could see in my project. Not sure what happened, but is just stopped working (not sure what I did to provoke that).

still cant get it to work.
Mar 21, 2011 at 5:09pm
still cant get it to work.
You're including the wrong thing. Do a search for msado*.tlb. I have 5 different versions on my box, they have names like: msado27.tlb.

The file name you specify has to be a file that exists.
Mar 21, 2011 at 5:36pm
I have quite a few of those and none of them work with my import statment.

#import "c:\Program Files (x86)\Common Files\System\ADO\msado26.tlb"

generates the error:

1 IntelliSense: cannot open source file "C:/Users/John Smith/Documents/Visual Studio 2010/Projects/try7db/try7db/Debug/msado26.tlh" c:\users\John Smith\documents\visual studio 2010\projects\try7db\try7db\database.h 1 1 try7db

It is complaining about a tlh file in all cases.
Mar 21, 2011 at 7:47pm
You import the tlb and the compiler generates the thl file.

I just tested it and on VC6, 2005, 2008, 2010. It compiles on VC6, the others have a namespace issue, but I don't get the error you see. You need to sort out your environment.
Mar 21, 2011 at 8:22pm
THANK YOU kbw.

Seems there must be an issue with my VS2010 which is odd since I just recently installed it. I have a side by side installation of VS2008 that I tried this in. It works, as you already said, with some issues which were resolved with the following modifications:
 
#import "c:\Program Files (x86)\Common Files\System\ADO\msado15.dll"  rename ("EOF","adoEOF") no_namespace 


I suppose I should begin by uninstalling and reinstalling VS2010 if I want to get it to work in that? I suppose Im happy enough to have it working in VS2008 no matter how that part turns out.

Thanks again for the help!
Mar 22, 2011 at 9:16am
Thanks for posting the fix.
Topic archived. No new replies allowed.