Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC -- inserting records into SQL Server
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
ODBC -- inserting records into SQL Server
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00998178
Message ID:
00998178
Views:
51
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?
Next
Reply
Map
View

Click here to load this message in the networking platform