?
Solved

Trying to run the HelloData example

Posted on 2002-05-13
10
Medium Priority
?
483 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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
 

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 300 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

807 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