Hi,
I am changing the sql database to database access (.mdb). The problem is when i run my application using sql connection its work well and all the tables are updated but when i use mdb connection it update some of the tables and few other table it does not update.
Its pop up with error message OVERFLOW. I have no idea why the error pops up as i don't find anything wrong with the connection or the statement.
Below is my code and the error pops up when it reach the place i highlight with red.
Please Help !!!
Public Function Update_POSBillTransaction() As Boolean
Dim strSQL As String = ""
Dim strSerialNo As String = "1"
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim drSerialNo As OleDbDataReader
myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & GEN_DB_NAME & "\POS.mdb" & ";")
myConnection.Open()
StepLog("modGeneral|Update_POSTransaction| GEN_DB_NAME |= " & GEN_DB_NAME)
' Get LatestTransactionNo from Parameter table
getLatestTransNo()
' Get SerialNo
sSQL = "SELECT MAX(SerialNo) FROM PaymentDetails WHERE KioskID=" & _clsDBHelper.mQuotedStr(KioskNo)
myCommand = myConnection.CreateCommand
myCommand.CommandText = sSQL
drSerialNo = myCommand.ExecuteReader
drSerialNo.Read()
'drSerialNo.Read()
If drSerialNo.HasRows Then
' Get SerialNo
If Not drSerialNo.IsDBNull(0) Then ' old transaction exist
strSerialNo = drSerialNo(0) + 1
Else ' new transaction
strSerialNo = 1
End If
End If
drSerialNo.Close()
CurrentTranxDateTime = Now
CurrentTranxDate = System.DateTime.Now.ToString("dd-MMM-yyyy")
CurrentTranxTime = System.DateTime.Now.ToString("hh:mm:ss tt")
BoothNo = BoothNo
StoreCity = StoreCity
ostrTransactionNo = TransactionNo
ostrSerialNo = strSerialNo
oCurrentTranxDateTime = CurrentTranxDateTime
oCurrentTranxDate = CurrentTranxDate
oCurrentTranxTime = CurrentTranxTime
oPOSTransCode = POSTransCode
Try
If myConnection.State = 0 Then
myConnection.Open()
End If
strSQL = "INSERT INTO Update_POSPaymentDetails ([KioskID],[KioskLocation],[TransactionNo], " _
& "[SerialNo],[TransactionDateTime],[TransactionDate],[TransactionTime],[TransactionCode], " _
& "[AgencyCode],[AgencyName],[AccountNo],[BillNo],[BillAmount],[PaidAmount]) " _
& "VALUES ('" & BoothNo & "','" & StoreCity & "','" & TransactionNo & "','" _
& strSerialNo & "','" & CurrentTranxDateTime & "','" & CurrentTranxDate & "','" _
& CurrentTranxTime & "','" & POSTransCode & "','" & SESSION_AGENCY_CODE & "','" _
& SESSION_AGENCY_NAME & "','" & SESSION_AGENCY_ACCNO & "','" & SESSION_AGENCY_BILLNO & "','" _
& SESSION_AGENCY_BILLAMO & "','" & SESSION_AGENCY_BILLTOT & "')"
StepLog("modGeneral|Update_POSBillTransaction| Update_POSPaymentDetails |strSQL |= " & strSQL)
myCommand = New OleDbCommand(strSQL, myConnection)
myCommand.ExecuteNonQuery()
myConnection.Close()
Catch ex As Exception
WriteToLogFile("modGeneral|Update_POSBillTransaction| " & ex.Message)
End Try
End Function