How to transfer a data from one table to another

Answered How to transfer a data from one table to another

  • Sunday, March 17, 2013 4:58 AM
     
      Has Code
     
      cmd.CommandText = "insert into TBL_DEPOSITTRANS (DepositName, AccountNo, Receipt, InterestAmt, Date1, TransNo) select (name, acc_no, amount, fine, date, recept_no ) from temp WHERE status='N'"
          

    but during execution an error occured like

    Incorrect syntax near ','

All Replies

  • Sunday, March 17, 2013 5:02 AM
    Moderator
     
     Answered Has Code

    Does the table tbl_DepositTrans have any triggers?

    Also, you don't need () after SELECT. In other words, your code should be

    cmd.CommandText = "insert into TBL_DEPOSITTRANS (DepositName, AccountNo, Receipt, InterestAmt, Date1, TransNo) select name, acc_no, amount, fine, date, recept_no FROM temp WHERE status='N'"
          


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

  • Sunday, March 17, 2013 5:37 AM
     
      Has Code
     
      cmd.CommandText = "insert into TBL_DEPOSITTRANS (DepositName, AccountNo, Receipt, InterestAmt, Date1, TransNo) select (name, acc_no, amount, fine, date, recept_no ) from temp WHERE status='N'"
          

    but during execution an error occured like

    Incorrect syntax near ','

    you dont need brackets with Select statement..

    cmd.CommandText = "insert into TBL_DEPOSITTRANS (DepositName, AccountNo, Receipt, InterestAmt, Date1, TransNo) select name, acc_no, amount, fine, date, recept_no from temp WHERE status='N'"

    Try this it will work )


    Please Mark as Answer if my post works for you or Vote as Helpful if it helps you. Kapil Singh