Dim intNumRows As Integer
strSQL = "SELECT COUNT(*) FROM member WHERE Username = '"& Me.txtUsername.Text &"' AND [Password] = '"& Me.txtPassword.Text &"' "
objCmd = New OleDbCommand(strSQL, objConn)
intNumRows = objCmd.ExecuteScalar()
IF intNumRows > 0 Then//อันนี้คือมีข้อมูลอยู่
Session("strUser") = Me.txtUsername.Text
Response.Redirect("Page1.aspx")
Else//อันนี้ไม่มีข้อมูล
Me.pnlLogin.Visible = False
Me.lblStatus.Visible = True
Me.lblStatus.Text = "Username/Password is wrong."
End IF
Try
Dim sql As String
sql = "SELECT ตรวจสอบอะไรก็ว่าไป FROM จากตารางไหน WHERE อะไรที่จะตรวจ"
Dim dr As OleDbDataReader
Dim com As OleDbCommand
com = New OleDbCommand()
With com
.CommandType = CommandType.Text
.CommandText = sql
.Connection = Conn
.Parameters.Clear()
dr = .ExecuteReader()
If dr.HasRows Then
ถ้ามีเเล้วให้ทำอะไร
Else
ถ้าไม่มีให้ทำอะไร
End If
End With
Catch ex As Exception
Error ให้เเสดงอะไร
End Try
Dim i As Integer = 0
Dim tempProid As String = ""
For i = 0 To lsvreceive.Items.Count - 1
tempProid = (lsvreceive.Items(i).SubItems(0).Text And lsvreceive.Items(i).SubItems(1).Text)
If (txtOrderID.Text And txtproid.Text) = tempProid Then
MessageBox.Show("คุณเลือกรหัสสินค้าซ้ำกัน!!!", "ผลการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
txtproid.Text = ""
txtproname.Text = ""
txtunit.Text = ""
txtprice.Text = "0.00"
txtqty.Text = "0"
txtproid.Focus()
Exit Sub
End If
Next