troubleshooting Question

Newbie ADO.Net Question

Avatar of DanielSKim
DanielSKim asked on
Visual Basic.NET
20 Comments1 Solution609 ViewsLast Modified:
I am trying to translate something i did in Access and ADO to VB.NET and ADO.NET. Any help would be greatly appreciated.

Here's my old code:
Dim strCnn As String
Dim strSQL1 As String
Dim strSQL2 As String
Dim cnn As New ADODB.Connection
Dim rst1 As New ADODB.Recordset
Dim rst2 As New ADODB.Recordset

' my connection string

strCnn =
cnn.Open strCnn

strSQL1 = "SELECT HLC, M FROM TableName1"

rst1.Open strSQL1, cnn

' retrieve field names and aliases for second recordset
Do Until rst1.EOF
    strSQL2 = strSQL2 & rst1!M & " " & rst1!HLC & ", "

strSQL2 = "SELECT " & Left(strSQL2, Len(strSQL2) - 2) & " FROM TableName2"

rst2.Open strSQL2, cnn

Do Until rst2.EOF
    ' do something


Set rst1 = Nothing
Set rst2 = Nothing
Set cnn = Nothing

I am very new to VB.NET and ADO.NET, so I don't mind very detailed and comprehensive answers.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros