Imports System.Data.SqlClient
Dim sqlConnection As SqlConnection
Dim sqlCommand As SqlCommand
Dim dr As New SqlDataReader
connstring = "Data Source=localhost;Initial Catalog=Test;User id=username;password=password;"
sqlcon.ConnectionString = connstring
sqlcon.Open()
sqlCommand = New SqlCommand("Select * from tablename", sqlConnection)
dr = sqlcommand.ExecuteReader()
While dr.read
Msgbox dr("FirstField")
Msgbox dr("SecondField")
End While
dr.close
sqlconnection.close
No comments:
Post a Comment