Hi Liquid. Welcome to TSDN!
C# and VB.NET are pretty much the same, although the syntax is a little different. I'm not that good with VB.NET so this may not be entirely correct, but I think it's pretty close.
-
' Create connection and command
-
Dim connection As New SqlConnection("Your connection string here")
-
Dim command As SqlCommand = connection.CreateCommand()
-
command.CommandText = "SELECT tblID FROM tbl"
-
-
' Execute command and read all rows
-
Dim reader As SqlDataReader = command.ExecuteReader()
-
Dim rowNum As Integer = 1
-
While (reader.Read())
-
Console.WriteLine("Row {0}: {1}", rowNum, reader("tblID"))
-
rowNum = rowNum + 1
-
End While
-
-
' Close
-
reader.Close()
-
connection.Close()
-
Note that this code is using the SqlConnection objects, so it will not be able to connect to MySQL, but the MySqlConnection objects should work pretty much the same.