Results 1 to 9 of 9

Thread: How to Update the access table rows with relative rows from another table

Threaded View

  1. #9

    Thread Starter
    Lively Member
    Join Date
    Oct 2011
    Posts
    76

    Re: How to Update the access table rows with relative rows from another table

    Dear all...
    After trying and find the below update query but i am not able to achieve what i required.

    Code:
    Dim conn1 As New OleDbConnection("My Connection String")
    
    Dim query1 As String = "UPDATE CashDepositTran SET CashDepositTran.WidrawAmt  = CashDepositTran.WidrawAmt  - '" & outPutString & "' WHERE CashDepositTran.CTranID IN (1,2)"
    
    Dim Cmd1 As New OleDbCommand(query1, conn1)
    conn1.Open()
    With Cmd1
    .ExecuteNonQuery()
    End With
    Cmd1.Dispose()
    conn1.Close()
    After excuting the UPDATE query its updating by concatenate the output values (mentioned bold in table)

    Table: CashDepositTran (Before UPDATE Query)
    CTranID | CRegID | CashDepDate | UserID | DepAmt | WidrawAmt
    1 | 1 | 09/Mar/2013 | 123 | 10000 | 10000
    2 | 1 | 09/Mar/2013 | 123 | 500 | 500

    10000500 and updating in each rows as below

    Table: CashDepositTran (After UPDATE Query)
    CTranID | CRegID | CashDepDate | UserID | DepAmt | WidrawAmt
    1 | 1 | 09/Mar/2013 | 123 | 10000 | -9990500
    2 | 1 | 09/Mar/2013 | 123 | 500 | -10000000
    Last edited by tnncprojects; Apr 28th, 2013 at 09:43 AM.

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