Solved

Trying to run the HelloData example

Posted on 2002-05-13
10
456 Views
Last Modified: 2008-01-09
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
Comment
Question by:AustinKalb
  • 5
  • 5
10 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 7006971
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
 

Author Comment

by:AustinKalb
ID: 7006991
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
 
LVL 22

Expert Comment

by:rspahitz
ID: 7006999
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
 

Author Comment

by:AustinKalb
ID: 7007039
the new reference may well be associated with visual basic . net. what do you think i should try next?
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7007076
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:AustinKalb
ID: 7007263
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
 
LVL 22

Expert Comment

by:rspahitz
ID: 7007311
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
 

Author Comment

by:AustinKalb
ID: 7007326
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
 
LVL 22

Accepted Solution

by:
rspahitz earned 100 total points
ID: 7007331
>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
 

Author Comment

by:AustinKalb
ID: 7016529
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now