/ Published in: VB.NET
edit database using vb + access
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Private Sub EditRental() Dim RentalDR As DataRow = frmRental.dsRental.RENTAL.Rows.Find(CInt(lblID.Text)) uProceed = True '-- not needed for basic edit/update Try '' Edit anything you want to edit RentalDR.BeginEdit() RentalDR("rDesc") = txtDesc.Text RentalDR("rAmount") = CDbl(txtAmount.Text) RentalDR("rStatus") = cmbStatus.Text RentalDR.EndEdit() Catch ex As Exception iProceed = False ' Block procedures if exception happens. MessageBox.Show("Please check your input. Make sure all input is correct.", "Invalid Input(s)", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End Try If uProceed = True Then Try frmRental.daRental.Update(frmRental.dsRental) MessageBox.Show("Database successfully updated.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) Catch ex As Exception MessageBox.Show("Somehow I cannot update the database. =(", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End If End Sub