Solved

Help needed with Visual studio Express program 'Hello Data'

Posted on 2011-09-09
7
651 Views
Last Modified: 2012-05-12
Hi Experts,
Please see http://msdn.microsoft.com/en-us/library/ms681004(v-VS.85).aspx
It looks like this program does everything I need, so being total newbie I tried to follow the insructions using Visual Studio Express 2010. but its not working.
First problem it says 'create a standard EXE visual basic project', but this option is not there.  I selected Visual Basic Windows Form.  I copied the code from Hello Data into the code window, but I get about 50 errors such as
Error      1      'Option' statements must precede any declarations or 'Imports' statements.      C:\Documents and Settings\ronnie\my documents\visual studio 2010\Projects\HelloData\HelloData\Form1.vb      4      1      My Project
Error      2      'adStateOpen' is not declared. It may be inaccessible due to its protection level.      C:\Documents and Settings\ronnie\my documents\visual studio 2010\Projects\HelloData\HelloData\Form1.vb      14      37      My Project
Error      3      'adUseClient' is not declared. It may be inaccessible due to its protection level.      C:\Documents and Settings\ronnie\my documents\visual studio 2010\Projects\HelloData\HelloData\Form1.vb      48      39      My Project
Error      4      'adOpenStatic' is not declared. It may be inaccessible due to its protection level.      C:\Documents and Settings\ronnie\my documents\visual studio 2010\Projects\HelloData\HelloData\Form1.vb      56      47      My Project
Error      5      'adLockBatchOptimistic' is not declared. It may be inaccessible due to its protection level.      C:\Documents and Settings\ronnie\my documents\visual studio 2010\Projects\HelloData\HelloData\Form1.vb      57      29      My Project
Error      6      'adCmdText' is not declared. It may be inaccessible due to its protection level.      C:\Documents and Settings\ronnie\my documents\visual studio 2010\Projects\HelloData\HelloData\Form1.vb      57      52      My Project


What is wrong its probably something quite simple ?
Thanks
Grace
0
Comment
Question by:GracefBase
7 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 36510221
Error      1
You've probably got something along the lines of:

Imports System
Imports System.Text

Option Explicit On

Open in new window


Not the structure, not the content. "Option" statements need to be the first lines of your file. A corrected version of the above would be:

Option Explicit On

Imports System
Imports System.Text

Open in new window


Error      2 - 6
The compiler cannot find the constants referred to in the errors. This might be a repercussion of the first error, so try correcting that first and then recompiling. If that doesn't correct the issue, then we might need to explore your code.
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 36510223
Not the structure, not the content
That should have read:

Note the structure, not the content
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36510268
The unknowns are ADO constants, so you need to set a reference to the Microsoft Active Data Objects Library
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:GracefBase
ID: 36511613
Kaufmed,
Thanks I have got rid of the first error.

Hi Graham,
I have already set a reference to this library and it shows up in the references against the project.
However I keep getting the error
' is not declared. It may be inaccessible due to its protection level.'

Thanks
Grace
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 36511675
Try erasing one of the "ad..." parameters up to (but not including) the equals symbol; then hit the spacebar. Intellisense should pop up and list the available options you can use for that variable assignment. Pick the one that closest matches the one you erased, for each occurrence.
0
 
LVL 15

Accepted Solution

by:
x77 earned 500 total points
ID: 36516066
You can include references from Ado and Vb6 controls on your code.

You says " so being total newbie ".
I think, a Interop project is not the best entry point to learn VB.Net.
Yo get a Vb6 Project and try to code it on Vb.Net.

NetFramework uses ADO.Net. It is full managed code.
The Windows Controls can bind to Ado.Net classes, but can´nt bind to Vb6 Ado.

Ado.Net is most powerfull and has best code organization.
I suggest you find some samples with ADO.Net and DataGridView.

It is easy to include a DataSet on your Project, then Drag a DataTable to your Form and you get a first Data Application With DataBinding and Ado.Net.
0
 

Author Closing Comment

by:GracefBase
ID: 36522055
Thanks for help and clear explanation.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

707 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

15 Experts available now in Live!

Get 1:1 Help Now