Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ODBC -- inserting records into SQL Server
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00998178
Message ID:
00998180
Vues:
20
This message has been marked as the solution to the initial question of the thread.
See Re: Remote (SQL-Server) Query Message #875085 for the proper way to handle ODBC errors. To make your INSERT work, prefix variable with '?' to make them SPT parameters.
pn_sqle = SQLExec(pn1, "INSERT vz_notes (dbacct, dataline) VALUES(?pc_acct, ?pc_data)")
>I am trying to insert records into SQL Server from Fox via ODBC, and this should be a simple task (I've been selecting data without problem), but I'm having no luck so far.
>
>My coding (simplified) is:
>	CREATE DATABASE test
>	CREATE CONNECTION MyODBC 
DATASOURCE "purges_tmp" 
USERID "taskadmin" PASSWORD "taskadmin"
>	pn1 = SQLConnect( pc_dsrc, pc_uid, pc_uid )
>	DISPLAY CONNECTIONS
>	SELECT dlvm
>	pc_acct = acct_no
>	pc_data = dataline
>	pn_sqle = SQLExec(pn1, "INSERT vz_notes (dbacct, dataline) VALUES(pc_acct, pc_data)")
>	=SQLDISCONNECT( pn1)
>	DELETE CONNECTION MyODBC
>I am consistently getting a return of 1 for the SQLConnect, and (-1) on the SQLExec. Is my syntax wrong, or could the SQL Server table be locked to updates? What am I missing here?
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform