Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql tables with views for dummies
Message
From
18/06/2003 11:11:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/06/2003 10:31:11
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00801159
Message ID:
00801177
Views:
13
>Hi All,
>
>The whole concept of views for SQL database is new for me. I have read a lot about but still have a problem with it.
>
>I am converting a network application, which worked nicely in the past with VFP database and tables to SQL tables with views. I have a transaction table of 1 million records (29 fields).
>The problem is that any time I open a form and the view is in the data environment, it does the whole SQL select again. This takes very long time (about 2 minutes) and no one can wait so long just to open a form.
>I have tried to load with no data, which is naturally fast, but it's not really helping as I need to view previous data when data is entered in the form (balances etc.). Furthermore, when the user has saved his entry, and stays in the same form, the data is not updated. i.e the view saves the data to the original SQL tables, but it does not update itself with other users' new transactions. I am using local views. Should I use remote views?
>
>In a nutshell: How is possible to work with a view the same way I used to work with a table, so that it will updated all times.
>
>I am a bit lost here. Could you share some experience with me?
>
>Thanks in advance
>
>Jonathan

With SQL server (or any backend other than VFP) you should use Remote Views.
Create your views with parameters. ie: select would look like :

create sql view v_orders as ;
select cust_id, order_id, .. from orders where cust_id = ?custID

Set nodataonload to .t. as you did. When you know which cust_id to work with :

m.custID = ....
requery('v_orders')

You'd be getting only one customer's orders so it'd be faster.
From there on consider you're working with a buffered table (by default rowbuffered) and you need to requery('v_orders') to 'refresh' with current data.

When you get comfortable with it, next step (or might directly do with it) is using SQL Pass Through (SPT). It might be faster and you'd have more control (while loosing some that're available to RVs only - like datatype changing).

Wish you had VFP8. Cursoradapter makes it easy to work with ODBC, OLE, Native cursors (and XML).
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
Previous
Reply
Map
View

Click here to load this message in the networking platform