Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating remote view
Message
De
22/09/2003 05:48:40
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00830955
Message ID:
00831008
Vues:
15
>Hello,
>
>I need to create a view, which the user can edit. Therefore I plan to let the user edit two memo fields in a table, one for the SQL remote view definition, and another for the connection.
>
>Then I can create the connection as a text file (COPY MEMO ...), and the view I can create using EXECSCRIPT().
>I know very well how to create local views, but I do not know about remote views.
>What I do not know is how the connection to the Oracle database is being made, I could not find too much info in the VFP help. So I would appreciate to see an example how to create the connection in code and how the view uses this connection.
>
>Thanks for the input in advance.

Christian,
Check www.connectionstrings.com for connection string.
Assuming you get a valid connection string, IMHO creating a view for each and every connection and SQL definition would be overkill. Each view would be added to DBC causing it to bloat. Besides the view itself you'd need the update codes. Instead you might create it as an SPT cursor and make updatable. ie (with SQL server as I don't have Oracle) :
lnHandle=Sqlstringconnect('DRIVER=SQL Server;SERVER=servername;'+;
  'DATABASE=pubs;uid=UserID;pwd=password;')
SQLExec(lnHandle,'select * from dbo.authors','v_authors')

CursorSetProp('KeyFieldList','au_id','v_authors')
CursorSetProp('WhereType',1,'v_authors')
CursorSetProp('Tables','authors','v_authors')

CursorSetProp("UpdateNameList", ;
  "au_id    authors.au_id,"+;
  "au_lname authors.au_lname,"+;
  "au_fname authors.au_fname,"+;
  "contract authors.contract",'V_authors')

CursorSetProp('UpdatableFieldList','au_fname,au_lname,contract','v_authors')
CursorSetProp('SendUpdates',.T.,'v_authors')
CursorSetProp('Buffering',5,'v_authors')
Browse
Tableupdate(2,.T.,'v_authors')
SQLExec(lnHandle,'select * from dbo.authors','afterupdate')
SQLDisconnect(lnHandle)
Select afterupdate
Browse
If you create it as a view in VFP7 you could use connstring clause to set connection string. You could even pass an empty string and cause ODBC dialog to pop up. ie:

use myView connstring ""

In VFP8 you could use CursorAdapter and connect with ODBC or ADO.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform