Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO Insert
Message
De
12/03/1999 10:51:52
Robert Byrd
National Association of Homebuilders
Washington, District de Colombia, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
ADO Insert
Divers
Thread ID:
00196815
Message ID:
00196815
Vues:
76
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform