Download Indoor Biometric Security with SMS alert System and Electronic
Transcript
GlobalFunctions.connection.Close()
Me.txtID.Text = ""
Me.txtID.Focus()
Else
'call add account function
ADD_ACCOUNT()
End If
End Sub
Sub ADD_ACCOUNT()
' Connect to Database
GlobalFunctions.db_connect()
Dim command As MySqlCommand
Dim transaction As MySqlTransaction
transaction = GlobalFunctions.connection.BeginTransaction()
Try
'call sql insert command
command = New MySqlCommand("INSERT INTO account_records values('','" &
txtID.Text & "','" & txtname.Text & "','" & TxtAddress.Text & "','" &
Me.Cbogender.Text & "','" & Me.Txtcontact.Text & "' ,'" &
Me.DateTimePicker1.Value.Date & "','" & Me.txtusername.Text & "','" &
Me.txtPassword.Text & "','" & Me.CboAcctType.Text & "','" & Me.checkSMS.Checked &
"') ", GlobalFunctions.connection, transaction)
' command.Parameters.Add(New MySqlParameter("image", imgBytes))
command.ExecuteNonQuery()
transaction.Commit()
strid = txtID.Text 'variable for enrolling Fprint
ClearTextBox(Me)
'clear textboxes
Dim f As New frmEnrollFinger
With f
f.ShowDialog()
End With
Catch ex As MySqlException
MessageBox.Show("Error in inserting new data! Error: " & ex.Message,
"Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
transaction.Rollback()
End Try
'close connections
GlobalFunctions.connection.Close()
End Sub
Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCancel.Click
ClearTextBox(Me)
Me.Close()
End Sub
93