Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC Data Sources
Message
 
To
28/05/1999 15:58:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00224119
Message ID:
00224877
Views:
21
Bob;

Here's the code I promised:

* Testing creation of SQL Data Source
* See VFP Documentation on SQLConnetc, SQLExec and SQLDisConnect
*
declare integer SQLConfigDataSource in odbccp32 Integer, Integer, String, String
settings="DSN=Employees"+chr(0)+"Description=Temporary Employee Data"+chr(0)+"FileType=Microsoft Access Driver (*.mdb)"+chr(0)+"DBQ=F:\projects\accountg\data\printing\infortext.mdb"+chr(0)+"MaxScanRows=16"
= SQLConfigDataSource(0,1,"Microsoft Access Driver (*.mdb)",settings)
* SQL Data Settings are created
STORE SQLConnect('Employees') TO gnConnHandle
IF gnConnHandle<=0
=MessageBox('Cannot Make Connection', 16, 'SQL Connect Error')
ENDIF
= SQLSETPROP(gnConnHandle, 'asynchronous', .F.)
WAIT WINDOW "Ready to Connect..."
= SQLEXEC(gnConnHandle, 'SELECT * FROM VALUSER Valuser', 'UserTemp')
*
* This is where you do your work with the tables. Here, I'm simply
* querying to a cursor for later use:
*!* SELECT _ssn_ AS Soc_Sec, LEFT(_Name_,35) AS Full_Name ;
*!* FROM UserTemp ;
*!* WHERE UserTemp._ssn_ NOT IN ;
*!* (SELECT Soc_Sec FROM Users);
*!* INTO CURSOR IntUsers

*Disconnect from Data Source:
=SQLDisConnect(gnConnHandle)
* And remove settings:
IsRemove =SQLConfigDataSource(1,3,"Microsoft Access Driver (*.mdb)",settings)
* SQL Data Settings are removed
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform