PSCTECH
asked on
Just starting out in VB.Net
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
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
Hi,
You can read this PAQ it has some examples how to handle SQL databases https://www.experts-exchange.com/questions/23349839/Looking-for-examples-of-SQL-database-interaction-in-VB-net.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
You can read this PAQ it has some examples how to handle SQL databases https://www.experts-exchange.com/questions/23349839/Looking-for-examples-of-SQL-database-interaction-in-VB-net.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
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks for the information, I really appreciate it
ASKER