[RESOLVED] [02/03] update problem
hi guys i have this prob to update the table
to update i am doing this
Code:
For i = 0 To a4PrdCode.GetUpperBound(0) - 1
mCmd = "Update BillList Set AmtPaid = AmtPaid - a4Amount(i), Bal = BillAmt - AmtPaid WHERE PRd_Code = '" & a4PrdCode(i) & "' AND = BillNo = '" & a4BillNo(i) & "' AND Ref = '" & a4Ref(i) & "' AND Code = '" & a4Code(i) & "'"
Dim cmd3 As New OleDbCommand(mCmd, MyConConnection)
cmd3.ExecuteNonQuery()
Next
what i want to do is update the amtpaid in the billlist table with the previous amtpaid - the current amt. paid...and so on...can someone guide me how to do that...coz it gives me an error...
what i have to do is to first use a datareader and take the value of amtpaid in a variable and then use the variable - a4amount(i) to replace it by using the parameters....i am sure there would b a way to do it without the need of getting the value of amtpaid in a variable....
i hope i am making myself clear....
thankx a lot for all the help extended to me by this forum members....
Re: [02/03] update problem
It looks to me like the error is in your SQL. Try this:
[CODE]
"Update [BillList] Set [AmtPaid] = [AmtPaid] - " & a4Amount(i) & ", [Bal] = [BillAmt] - [AmtPaid] WHERE [PRd_Code] = '" & a4PrdCode(i) & "' AND [BillNo] = '" & a4BillNo(i) & "' AND [Ref] = '" & a4Ref(i) & "' AND
Code:
= '" & a4Code(i) & "'"
Specifically, a4PrdCode(i) & "' AND = BillNo = '" you have an extra "=" between AND and BillNo.
Re: [02/03] update problem
great....i completely overlooked it ...i must have gone through the code sooo many time...but ijust overlooked it....thankx a lot MetalKid
u guys at this forum r soooo great...u know what i like the most about the guys in this forum....u guys..never never discourage even if someone asks stupid querries like i do....
thankx a lot...for the great help....