Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sample code for SQL Pass Through
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00157627
Message ID:
00157651
Views:
20
I'll give you a simple one here:
* Create connection to back end
lnSQLHandle = SQLCONNECT("myDSN","myUser","myPassword")

* Check for good connection
IF lnSQLHandle > 0
  * Send insert to back end
  lnResult = SQLEXEC(lnSQLHandle, "Insert Mytable Values('a','b','c')")

  * Check for successful insert
  IF lnResult <> -1
    WAIT WINDOW "Success!"
  ELSE
    * Show query error
    =AERROR(myErr)
    WAIT WINDOW myErr(1,2)
  ENDIF

  * Diconnect from back end
  =SQLDISCONNECT(lnSQLHandle)
ELSE
  * Show connection error
  =AERROR(myErr)
  WAIT WINDOW myErr(1,2)
ENDIF
HTH

>Is there any examples of a complete sequence for using sql pass through to insert new records into a table existing on an MS/sql server? I can't seem to find any full documentation.
>
>What I want to do is insert records into a database on a ms/sql server using SPT. Thanks in advance!
>
>Gary
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform