i new using the vb.net 2008 and i'm working on a payroll application to save entries in a form to an access database. However when i click on the save button (created on the form) to save the form entries into the access database table created, it comes up with the overflow error (when debugging in the IDE). I have checked the data types to find out if there is a conflict (data types used are text, number, currency and date/time for the fields) but i don't seem to see any. Can somebody please give a clue regarding what i'm doing wrong.
The code snippet that the save button executes is as follows --
Private Sub AddPaySlip()
Try
'Dim dbCommand As OleDbCommand
Dim DBConn As OleDbConnection
Dim DBInsert As New OleDbCommand
DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING)
DBInsert.CommandText = "INSERT INTO Payroll VALUES (" _
& "'" & dtpFromPay.Text & "', " _
& "'" & dtpToPay.Text & "', " _
& "'" & strSelectedAssignCode & "', " _
& "'" & txtWorkDays.Text & "', " _
& "'" & txtBasic.Text & "', " _
& "'" & txtRent.Text & "', " _
& "'" & txtPA.Text & "', " _
& "'" & txtMeal.Text & "', " _
& "'" & txtContis.Text & "', " _
& "'" & txtLevel.Text & "', " _
& "'" & txtBank.Text & "', " _
& "'" & txtOVT.Text & "', " _
& "'" & txtDesignation.Text & "', " _
& "'" & txtResearch.Text & "', " _
& "'" & txtDriver.Text & "', " _
& "'" & txtFieldTrip.Text & "', " _
& "'" & txtShift.Text & "', " _
& "'" & txtFurniture.Text & "', " _
& "'" & txtMedical.Text & "', " _
& "'" & txtUtility.Text & "', " _
& "'" & txtPCSource.Text & "', " _
& "'" & txtLeave.Text & "', " _
& "'" & txtArrears.Text & "', " _
& "'" & txtOthers1.Text & "', " _
& "'" & txtOthers2.Text & "', " _
& "'" & txtTaxes.Text & "', " _
& "'" & txtXmas.Text & "', " _
& "'" & txtNHF.Text & "', " _
& "'" & txtSurcharge.Text & "', " _
& "'" & txtMisc.Text & "', " _
& "'" & txtPensions.Text & "', " _
& "'" & txtHousing.Text & "', " _
& "'" & txtNetIncome.Text & "', " _
& "'" & txtGross.Text & "', " _
& "'" & txtTotalDed.Text & "', " _
& "'" & txtCarLoan.Text & "', " _
& "'" & txtCTSL.Text & "', " _
& "'" & txtSalaryAdv.Text & "', " _
& "'" & txtUnion.Text & "', " _
& "'" & DateTime.Now.ToString & "')"
I will so much appreciate replies as soon as possible. Thanks.
The code snippet that the save button executes is as follows --
Private Sub AddPaySlip()
Try
'Dim dbCommand As OleDbCommand
Dim DBConn As OleDbConnection
Dim DBInsert As New OleDbCommand
DBConn = New OleDbConnection(ACCESS_CONNECTION_STRING)
DBInsert.CommandText = "INSERT INTO Payroll VALUES (" _
& "'" & dtpFromPay.Text & "', " _
& "'" & dtpToPay.Text & "', " _
& "'" & strSelectedAssignCode & "', " _
& "'" & txtWorkDays.Text & "', " _
& "'" & txtBasic.Text & "', " _
& "'" & txtRent.Text & "', " _
& "'" & txtPA.Text & "', " _
& "'" & txtMeal.Text & "', " _
& "'" & txtContis.Text & "', " _
& "'" & txtLevel.Text & "', " _
& "'" & txtBank.Text & "', " _
& "'" & txtOVT.Text & "', " _
& "'" & txtDesignation.Text & "', " _
& "'" & txtResearch.Text & "', " _
& "'" & txtDriver.Text & "', " _
& "'" & txtFieldTrip.Text & "', " _
& "'" & txtShift.Text & "', " _
& "'" & txtFurniture.Text & "', " _
& "'" & txtMedical.Text & "', " _
& "'" & txtUtility.Text & "', " _
& "'" & txtPCSource.Text & "', " _
& "'" & txtLeave.Text & "', " _
& "'" & txtArrears.Text & "', " _
& "'" & txtOthers1.Text & "', " _
& "'" & txtOthers2.Text & "', " _
& "'" & txtTaxes.Text & "', " _
& "'" & txtXmas.Text & "', " _
& "'" & txtNHF.Text & "', " _
& "'" & txtSurcharge.Text & "', " _
& "'" & txtMisc.Text & "', " _
& "'" & txtPensions.Text & "', " _
& "'" & txtHousing.Text & "', " _
& "'" & txtNetIncome.Text & "', " _
& "'" & txtGross.Text & "', " _
& "'" & txtTotalDed.Text & "', " _
& "'" & txtCarLoan.Text & "', " _
& "'" & txtCTSL.Text & "', " _
& "'" & txtSalaryAdv.Text & "', " _
& "'" & txtUnion.Text & "', " _
& "'" & DateTime.Now.ToString & "')"
I will so much appreciate replies as soon as possible. Thanks.