Dim objConn As New SqlConnection
Dim objCmd As New SqlCommand
Dim strConnString, strSQL As String
strConnString = "Server=localhost;UID=sa;PASSWORD=;Database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn.ConnectionString = strConnString
objConn.Open()
Dim intNumRows As Integer
strSQL = "SELECT COUNT(*) FROM member WHERE Username = '" & Me.txtUsername.Text & "' AND Password = '" & Me.txtPassword.Text & "' "
objCmd = New SqlCommand(strSQL, objConn)
VB.NET/C# Connect to SQL Server Using ADO.NET พื้นฐานกับ SQL Server and ADO.NET