Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Insert Statement with ADO

Author  Topic 

ilimax
Posting Yak Master

164 Posts

Posted - 2005-03-17 : 09:36:12
I do not understand why this INSERT statement with ADO does not work ... I have error "Incorrect syntax near word Authorization" ... I really do not understand why???

sql="INSERT INTO arhPOSInvoicePayments ( [Invoice Number], [Line Number], [Date Paid], [How Paid], [How Paid Type], [How Paid Acct ID], [Authorization], [Amount Paid], [Amount Alloc], Comments, [Check] )
SELECT POSInvoicePayments.[Invoice Number], POSInvoicePayments.[Line Number], POSInvoicePayments.[Date Paid], POSInvoicePayments.[How Paid], POSInvoicePayments.[How Paid Type], POSInvoicePayments.[How Paid Acct ID], POSInvoicePayments.Authorization, POSInvoicePayments.[Amount Paid], POSInvoicePayments.[Amount Alloc], POSInvoicePayments.Comments, POSInvoicePayments.Check
FROM POSInvoicePayments
WHERE (((POSInvoicePayments.[Invoice Number])='" & myInv & "'));"

myCmd.CommandText = sql
myCmd.Execute

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-17 : 09:41:18
you need [] around Authorization and Check in your select list.
and loose all of the ( and ) in your where. you don't need them.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

ilimax
Posting Yak Master

164 Posts

Posted - 2005-03-17 : 10:09:17
quote:
Originally posted by spirit1

you need [] around Authorization and Check in your select list.
and loose all of the ( and ) in your where. you don't need them.

Go with the flow & have fun! Else fight the flow



Thanks
Go to Top of Page
   

- Advertisement -