Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Connection / SQLConnect
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00161962
Message ID:
00162166
Views:
25
It is perfectly OK to snip messages. I think you are getting there. One stumbling block is field names with spaces in Access. Eliminate them if possible.

I still think you need to setup an ODBC Data source for one of your Access DBs. Then look in the registry to see what it did. These keys and values in the registry will help you with your connection via VFP code and functions.

If you do not have many Access DBs, you could create a VFP DBC, add an ODBC DSN and a VFP connection for each Access DB, then start creating remote views to these Access tables. If you need to make the Access tables updateable, you can make the views in VFP updateable, identify the key and updateable fields, etc. I think you will find this much easier, although you would have to make sure each user has an identically named ODBC DSN created for each connection (which can be done by code the first time your VFP app is executed).

>Mark,
>
>I hope that it is Kosher removing the original communications but the email was getting a little long.
>
>Sorry about the confusion; at the time of the original message my mind was so muddled from reading help files and manuals and running around in circles that I probably didn't include all of the necessary details.
>
>What I'm trying to do from a VFP6 app is to connect to a user's MS Access file and then use SQL SELECT() to get the information into VFP where my app can then use it. Eventually I'll want to build in the same functionality for MS Excel.
>
>My confusion in reading the help files is that a lot of functions will talk about "Named Data Sources" and one said that it was for connecting without needing a "Named Data Source" and then I was reading the SQLConnect(cConnectionName) command that said that cConnectionName is created in CREATE CONNECTION hence my use of both of these commands.
>
>I started looking up the commands that you used in your example to register a DNS and noticed that they were Visual Developer commands and not commands that could be directly run from VFP so I started reading the VFP manual some more.
>
>I then discovered the SQLStringConnect() function that makes the connection with the connection string that I had built without any need for a DNS but just using the generic "DSN=MS Access 7.0 Database;". After that I discovered the SQLTabel() function so that I can present the user with a list of the tables in the choosen database and for him/her to pick the table that they want to use.
>
>That's about all I've had time for so far other than to see that I can't issue a SQL Select() on the chosen table directly from VFP but that, apparently, I need to use the SQLPrepare() and SQLExec() to issue the SQL Select() using the data source engin or whatever. I still haven't done this yet. Once I have a cursor that I can use in VFP then I'm free and clear other than all of the error traping (does Acess have all of the same field naming conventions as VFP, etc., etc. and if not what do I do about a cursor that is not VFP complent?).
>
>Anyway, I feel that I am making headway. My biggest stumbling block seem to be that my need is for VFP to connect to Access but all of the examples are for SQL Server to connect to something else using an established Named Data Source.
>
>Any light shed would be greatly appreciated since I'm still stumbling in the dark.
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform