Results 1 to 3 of 3

Thread: [RESOLVED] [02/03] update problem

  1. #1

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    Resolved [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....

  2. #2
    Fanatic Member MetalKid's Avatar
    Join Date
    Aug 2005
    Location
    Green Bay, Wisconsin
    Posts
    534

    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.
    If your problem is solved, please use the Mark Thread As Resolved under Thread Tools!

    Show Appreciation. Rate Posts!

  3. #3

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    493

    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....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width