Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO Insert
Message
From
12/03/1999 10:51:52
Robert Byrd
National Association of Homebuilders
Washington, District of Columbia, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
ADO Insert
Miscellaneous
Thread ID:
00196815
Message ID:
00196815
Views:
71
I want to execute as ADO commandtype asCmdText as follows:

>WITH THIS
> psString = IIF(EMPTY(psString),'Nothing',psString)
>
> loSQLCmd = CREATEOBJECT("adodb.command")
> IF !.mbError
> loSQLCmd.ActiveConnection = .moConnection
> loSQLCmd.commandtype = 1 &&adCmdText
> ENDIF
>
> lcName = .name
> lcErrType = 'Sally'
>
> lsCmd = 'INSERT lmerrlog(er_date, er_type, er_object, er_desc) VALUES (GETDATE(), "' + lcErrType + '", "' + lcName + '", "' + psString +'")'
> loSQLCmd.commandtext = lsCmd
> loSQLCmd.execute()
>
>ENDWITH

This returns an OLE Dispatch error as follows:

> -- CONN ERRORS ----------------
> DESCRIPT: [Microsoft][ODBC SQL Server Driver][SQL Server]The name 'Sally' is illegal in this context. Only constants, constant expressions, or variables allowed here. Column names are illegal.
> NUMBER: ****
> SOURCE: Microsoft OLE DB Provider for ODBC Drivers
> SQLSTATE: 37000
> NATIVE: 128


I am fairly new to ADO, and I know that I may have the option of using the .addnew property. But I am quite determined to find out why this does not work.

Thanks, Bob
Database Development Team
Next
Reply
Map
View

Click here to load this message in the networking platform