Posted By

javageget on 11/22/11


Tagged


Versions (?)

Add data using vb+access


 / Published in: VB.NET
 

  1. Private Sub AddData()
  2. Dim NewRow As DataRow = frmBuildingEditor.dsBill.BILL.NewRow
  3. Dim NewDate As String = Format(dtpDate.Value, My.Settings.DateFormat)
  4.  
  5. Try
  6. NewRow("IssuedDate") = CStr(DateTime.ParseExact(NewDate, My.Settings.DateFormat, iCultureInfo))
  7. NewRow("Description") = frmBuildingEditor.ValidateInput(txtDesc.Text)
  8. NewRow("Amount") = frmBuildingEditor.ValidateInput(CDbl(txtAmount.Text))
  9. NewRow("Status") = frmBuildingEditor.ValidateInput(cmbStatus.Text)
  10. NewRow("LotID") = frmBuildingEditor.ValidateInput(frmBuildingEditor.lblID.Text)
  11. Catch ex As Exception
  12. uProceed = False
  13. MessageBox.Show("Please check your input.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  14. End Try
  15.  
  16. If uProceed = True Then
  17. Try
  18. frmBuildingEditor.dsBill.BILL.Rows.Add(NewRow)
  19. frmBuildingEditor.daBill.Update(frmBuildingEditor.dsBill)
  20.  
  21. MessageBox.Show("New Shop Lot successfully registered.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
  22.  
  23. frmPersona.AddLog(String.Format("[+] Added bills [ID:{0}..]", frmBuildingEditor.dsBill.BILL.Rows(frmBuildingEditor.dsBill.BILL.Rows.Count - 1).Item(0).ToString))
  24.  
  25. frmBuildingEditor.ReloadBills()
  26. Me.Close()
  27.  
  28. Catch ex As Exception
  29. MessageBox.Show("Ops! There's an error occurred while adding data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  30. End Try
  31. End If
  32. End Sub

Report this snippet  

You need to login to post a comment.