My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com
Sample Program Output
Program Listing
Public Class Form1
Private Sub Logins()
Try
query = "SELECT * FROM tbluser WHERE USERNAME = '" & txtUser.Text & "' AND PASSWORD = '" & txtPwd.Text & "'"
cmd = New OleDb.OleDbCommand(query, conn)
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If dr.Read = True Then
Dim fx As New Form2
Me.Hide()
fx.Show()
Else
MsgBox("Incorrect username or password!", MsgBoxStyle.Critical, "Login")
txtPwd.Focus()
End If
Catch ex As Exception
MsgBox(ex.Message)
Finally
End Try
End Sub
Private Sub btnLogin_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Logins()
End Sub
Private Sub btncancel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancel.Click
If MsgBox("Are you sure you want to close?", MsgBoxStyle.YesNo, "Close Window") = MsgBoxResult.Yes Then
End
End If
txtUser.Focus()
End Sub
Private Sub txtPwd_GotFocus1(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPwd.GotFocus
AcceptButton = btnLogin
End Sub
Private Sub txtUser_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtUser.GotFocus
AcceptButton = btnLogin
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
connect()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If (txtid.Text <> vbNullString And txtfn.Text <> vbNullString And _
txtmn.Text <> vbNullString And txtln.Text <> vbNullString And _
txtun.Text <> vbNullString And txtp.Text <> vbNullString And _
txtrp.Text <> vbNullString) Then
If Me.txtp.Text = Me.txtrp.Text = False Then
MsgBox("Password didn't match!")
txtp.Text = ""
txtrp.Text = ""
Else
Dim DS As DataSet = New DataSet
Dim DA As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
DA.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM tbluser WHERE ID='" & txtid.Text & "'", conn)
DS.Clear()
DA.Fill(DS)
If DS.Tables(0).Rows.Count = 0 Then
query = "INSERT INTO tbluser VALUES ('" & Me.txtid.Text & "','" & txtfn.Text & "','" & txtmn.Text & "','" & txtln.Text & "','" & _
txtun.Text & "','" & txtp.Text & "')"
cmd = New OleDb.OleDbCommand(query, conn)
cmd.ExecuteNonQuery()
cmd.Dispose()
MsgBox("New Information Added", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Success")
Me.txtfn.Text = ""
Me.txtmn.Text = ""
Me.txtln.Text = ""
Me.txtun.Text = ""
Me.txtp.Text = ""
Me.txtrp.Text = ""
Else
MsgBox("The ID Number entered is already found? Please check information." & vbCrLf & vbCrLf & "If you think this is an error, " & _
"Please inform the Administrator.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Error: Duplicate ID Number found")
txtid.Focus()
Exit Sub
End If
End If
Else
MsgBox("Some fields are left blank. Please fill-up all information.", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Error: Blank Fields found")
txtid.Focus()
End If
End Sub
End Class
MODULE
-Codes for database connection and Variable Declarations
Module Module1
Public conn As New OleDb.OleDbConnection
Public query As String
Public DA As OleDb.OleDbDataAdapter
Public DS As DataSet
Public cmd As OleDb.OleDbCommand
Public dr As OleDb.OleDbDataReader
Sub connect()
conn = New OleDb.OleDbConnection
conn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & _
"\data.mdb;user id=admin;jet oledb:database password=987"
Try
If conn.State = ConnectionState.Closed Then
conn.Open()
'MsgBox("Connection Success")
End If
Catch ex As Exception
MsgBox("Error Connection" & Err.Description)
End Try
End Sub
End Module