• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

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.
0
AustinKalb
Asked:
AustinKalb
  • 5
  • 5
1 Solution
 
rspahitzCommented:
Generally errors like that appear when you are missing a reference, in this case most likely missing the reference to the ADO.net object.
0
 
AustinKalbAuthor Commented:
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
0
 
rspahitzCommented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
AustinKalbAuthor Commented:
the new reference may well be associated with visual basic . net. what do you think i should try next?
0
 
rspahitzCommented:
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."
0
 
AustinKalbAuthor Commented:
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.
0
 
rspahitzCommented:
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.

0
 
AustinKalbAuthor Commented:
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"
0
 
rspahitzCommented:
>Can you verify...

Locate the place in .net where it tells you information about added components libraries, and see what it says.

In VB6 it was menu Project|References.  When you go there in VB6, you get a list of registered dlls, type libraries (tlbs), ocxs, etc. with descriptive names and a checkbox.  The checked items are included in the project.  When you click on one, it tells you the actual file name in a frame at the bottom.

If ADO.net's dll (or whatever) is not included, it's not part of your project and you would get the types of issues you're mentioning.
0
 
AustinKalbAuthor Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now