Link to home
Start Free TrialLog in
Avatar of AustinKalb
AustinKalb

asked on

Trying to run the HelloData example

I am trying to run the HelloData example from Microsoft in Vusial Studio / Visual Basic.net. The MSDN link is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdtuthellodata.asp . The ADODB enums are not being reconized. For example:

C:\HelloData\HelloData\Form1.vb(159): Name 'adCmdText' is not declared.

Cant figure out how to get them reconized without fully qiualifing the enum (e.g., ADODB.CursorTypeEnum.adOpenStatic instead of adOpenStatic). This is especially a pain, since its not always obvious what the qualification should be. Im sure there is an easy solution.. what is it?!

Thanks
Austin.
Avatar of rspahitz
rspahitz
Flag of United States of America image

Generally errors like that appear when you are missing a reference, in this case most likely missing the reference to the ADO.net object.
Avatar of AustinKalb
AustinKalb

ASKER

no so easy... in the References limb of the Solution Explorer is the reference to ADODB (Description: Microsoft ActiveX Data Objects 2.7 Library). Note that when I replace the enum with the fully qualified enum - I no longer get the "not declared" mesage - and the ado statement works fine.

The only potentially funny thing is that while the reference said msado15.dll whe i was selecting it, after its included in the project the "Path" points to C:\WINNT\assembly\GAC\ADODB\7.0.3300.0__b03f5f7f11d50a3a\ADODB.dll
I really haven't tried .net yet, but in VB you could right-click on an item and one of it's choices was 'definition'.

Obviously, if the item cannot be qualified by VB, it thinks it's undefined.

Since there reference originally pointed to msado15.dll, maybe you need to remove that reference and locate and add the correct one.  I'm starting to think that there may be a conflict in the names...i.e. the missing reference is in an upgraded version of the dll and the app is referencing the old one.
the new reference may well be associated with visual basic . net. what do you think i should try next?
Since I don't have .net available right now, I can't reproduce the problem, and maybe other experts will chime in shortly.

Meanwhile, how are you running the example?  Did you install .net in a new folder?  Do you also have VB6?

Maybe for now you can simply define adCmdText with a value=1 since that's the value in VB6.

Did you also go to the link on the webpage you mentioned:

"To run HelloData
1. Create..., see Referencing the ADO Libraries."
i have vb6 on another system.. but i'm trying to get all this to work on the .net system.

Its not just adCmdText.. there are lots of references. I can paste in the code if that would be helpful - although the .net adds a bunch of new stuff.

I found an ADO introduction on the MSDN site. It starts with the suggestion that one review the HelloData program.
Actually, the part I'm confused about is why adCmdText even comes up as invalid unless the reference doesn't exist.  This is part of VB6, so if the reference is msado15.dll you should have it included.  If it's not part of ADO.Net, then it shouldn't even be in the example.

Can you verify the ADO reference and number.

it appears as if the example was written for vb6, not .net. All the same the enum's are unresolved.

I'm not sure what you want re "Can you verify the ADO reference and number"
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm not going to try and answer this question.. dot net is differnet that vb6 - i'm using c++ instead. thanks for your help.