If TextBox1.Text = "" And TextBox2.Text = "" Then
MsgBox("กรุณาระบุ Username และ Password")
ElseIf TextBox1.Text <> "" And TextBox2.Text = "" Then
MsgBox("กรุณาระบุ Password")
End If
Dim userCON As New SqlClient.SqlConnection()
Dim userCOM As New SqlClient.SqlCommand()
Dim strConnstring, strSql As String
strConnString = "Server=Pratcharat-pc\SQL2005;UID=sa;PASSWORD=;database=Payment;Max Pool Size=400;Connect Timeout=600;"
userCON = New System.Data.SqlClient.SqlConnection(strConnstring)
userCON.Open()
strSql = "Select * from Username where Username = '" & TextBox1.Text & "' AND Password = '" & TextBox2.Text & "' "
userCOM = New System.Data.SqlClient.SqlCommand()
With userCOM
.Connection = userCON
.CommandType = CommandType.Text
.CommandText = strSql
End With
userCOM.ExecuteNonQuery()
userCON.Close()