Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Using conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
- "C:UserslenovoDesktopVB SystemsPOS simpleSP1SPoS1 Database.accdb" & _
- ";Jet OLEDB:Database Password=admin1234")
- Using cmd = New OleDbCommand()
- conn.Open()
- cmd.Connection = conn
- cmd.CommandText = "UPDATE Employees SET [Employee ID]=@ID, [First Name]=@Fname, [Last Name]=@Lname," & _
- "[Date of Birth]=@DoB, [Age]=@Age, [Password]=@Pass WHERE [Employeee ID]=" & frmAdminMain.IDtoUpdate
- cmd.Parameters.Clear()
- cmd.Parameters.AddWithValue("@ID", txtID.Text)
- cmd.Parameters.AddWithValue("@Fname", txtFname.Text)
- cmd.Parameters.AddWithValue("@Lname", txtLname.Text)
- cmd.Parameters.AddWithValue("@Dob", DateTime.Parse(Format(dtpDoB.Value, "MM/dd/yyyy")))
- cmd.Parameters.AddWithValue("@Age", GetCurrentAge(dtpDoB.Value))
- cmd.Parameters.AddWithValue("@Pass", txtPass.Text)
- Try
- cmd.ExecuteNonQuery()
- conn.Close()
- txtID.Clear()
- txtFname.Clear()
- txtLname.Clear()
- txtPass.Clear()
- MsgBox("Record added successfully", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "Success")
- Catch ex As Exception
- MsgBox(ex.ToString, MsgBoxStyle.OkOnly Or MsgBoxStyle.Exclamation, "Error")
- End Try
- End Using
- End Using
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement