TheWizardofInt
Well-known member
Does anyone have an example of accessing a SQL database using ADO.Net?
I just need a kick start on this.
I just need a kick start on this.
Dim oConnection As New SqlConnection
Dim oCommand As New SqlCommand
Dim oDataReader As SqlDataReader
oConnection.ConnectionString = "user id=;password=;database=;server=;Connect Timeout=15"
oConnection.Open()
oCommand.Connection = oConnection
oCommand.CommandText = "SELECT * FROM myTable"
oDataReader = oCommand.ExecuteReader()
While oDataReader.Read()
Loop though data
End While
oDataReader.Close()
oConnection.Close()
dim conn as System.Data.SqlClient.SQLConnection
if conn.State = ConnectionState.Closed Connection closed
end if