Solved

Just starting out in VB.Net

Posted on 2008-06-12
4
216 Views
Last Modified: 2013-11-26
I am just switching from vb6 to vb.net.  I know, I'm way behind the curve.  I could really use some basic help on making a connection to an Access database and filling a form with a recordset.  VB.Net probably doesn't do it anything like VB6.

I will post my vb6 code to make clear what I am trying to achieve and would greatly appreciate the .net equivalent to the snippet.

Thanks in advance for any help
Public cn As New ADODB.Connection   

Dim strOpen as String

Dim rs As New ADODB.Recordset

 

strOpen = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDest

 

cn.Open strOpen 'open db connection object with connection string set above

 

 rs.Open "Select * from tbluser", cn, adOpenKeyset, adLockOptimistic

 Do While Not rs.EOF

    cboUserID.AddItem (rs.Fields("user_id") & ", " & rs.Fields("last_name") & ", " & rs.Fields("first_name"))

    rs.MoveNext

 Loop

 rs.Close

Open in new window

0
Comment
Question by:PSCTECH
  • 2
4 Comments
 

Author Comment

by:PSCTECH
Comment Utility
.
0
 
LVL 48

Expert Comment

by:jpaulino
Comment Utility
Hi,

You can read this PAQ it has some examples how to handle SQL databases http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23349839.html

You just have to change the Sql to Oledb classes (ex. SqlConnection will be OleDbConnection)

Also you can look examples in MSDN:
http://msdn.microsoft.com/en-us/library/system.data.oledb(VS.80).aspx
0
 
LVL 27

Accepted Solution

by:
planocz earned 500 total points
Comment Utility
0
 

Author Closing Comment

by:PSCTECH
Comment Utility
Thanks for the information, I really appreciate it
0

Featured Post

IT, Stop Being Called Into Every Meeting

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!

Join & Write a Comment

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 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

9 Experts available now in Live!

Get 1:1 Help Now