Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6SP5, programatically setup ODBC to DBCs
Message
From
17/12/2002 11:52:23
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00715393
Message ID:
00733723
Views:
27
Hi Sergey

I am even more confused now. Surely I dont want to keep creating the remote connection each time. Perhaps I should step back a bit.

What I am trying to achieve is to use a remote view via a DSN-Less connection.

Should I create a connection in my database and then access the views via that?

I am at a bit of a loss as to how I should implement this as remote views are all a bit new to me. Could you give me an example of how I would do this to access a VisualFoxpro database?

Regards
Geoff Scott


>Geoff,
>
>You cannot use connection handle created by SQLSTRINGCONNECT() or SQLCONNECT() in views in VFP7 and earlier. However, you can create connection to the remote source with connection string and use that connection for your views.
CREATE CONNECTION MyRemConn CONNSTRING lcConnStr
>>Hi Sergey
>>
>>I'm a bit confused here. I can get all this to work with a remote view I created using a dsn I had set up on my local pc.
>>
>>What I cant figure out is how to create the remote view without the DSN? I can create the view using a dummy. Perhaps I am missing something. The help seems to be a bit sparce, could you enlighten me???
>>
>>I added the following in my BeforeOpenTables
>>
>>
>>PUBLIC lnConn
>>lcConnStr = "DRIVER=Microsoft Visual FoxPro Driver;" + ;
>>    "SourceType=DBC;" + ;
>>    "SourceDB=F:\Work Order Tracking System\wots 2\data\wots.dbc"
>>lnConn = SQLSTRINGCONNECT(lcConnStr )
>>
>>USE wots!v_invhead IN 0 NODATA
>>USE wots!v_invitems IN 0 NODATA
>>
>>
>>which works fine on my local pc but when I run it from a different part of the network each 'USE' gives me the following error
>>
>>Connectivity error [Microsoft}{ODBC Driver Manager]
>>Datasource name not found and no default driver specified.
>>
>>
>>How do I specify the default driver???
>>
>>Regards
>>Geoff Scott
>>
>>>No, it wouldn't work because you cannot assign name to the DSN-less connection.
>>>
>>>>Thanks Sergey for the response. Now the Report Manager I am using (from Sourceforge.net) required a Named DSN in the report, is it possible I can give any name when I create the report and when I run your code I give it the name that is stored in the report. Also without a connection established I may or maynot be able to put in fields, haven't done it yet, try it out tonight.
>>>>
>>>>>>Sorry didn't read you're reply properly. What is DSN-Less connection and how can I proceed with it? Any pros and cons?
>>>>>>
>>>>>You create connection string in your program, for example
lcConnStr = "DRIVER=Microsoft Visual FoxPro Driver;" + ;
>>>>>    "SourceType=DBC;" + ;
>>>>>    "SourceDB=C:\Program Files\Microsoft Visual FoxPro 7\Samples\Data\testdata.dbc"
>>>>>lnConn = SQLSTRINGCONNECT(lcConnStr )
Pros: You don't have to create DSN's on user PC's.
>>>>>Cons: The connection parameters are stored in your application. So it's better to store themv in some kind of configuration file.
May all your weeds be wildflowers
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform