Imports System.Data
Imports System.Data.SqlClient
Public Class LoginForm1
Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
connection = New SqlConnection(conStr)
If connection.State = ConnectionState.Closed Then
connection.Open()
End If
End Sub
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
If UsernameTextBox.Text = "admin" And PasswordTextBox.Text = "admin" Then
MsgBox("รหัสผ่านถูกต้อง")
If sql = "SELECT * FROM Zone WHERE ZoneID IS NULL" Then
YardSet.Show()
Me.Hide()
ElseIf sql = "SELECT * FROM Zone WHERE ZoneID IS NOT NULL" Then
Home.Show()
Me.Hide()
End If
Else
MsgBox("Username หรือ Password ไม่ถูกต้อง")
End If
End Sub
End Class
Tag : .NET, Ms SQL Server 2008, VB.NET, VS 2010 (.NET 4.x)