Solved

Trying to run the HelloData example

Posted on 2002-05-13
10
459 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

896 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

17 Experts available now in Live!

Get 1:1 Help Now