Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Help with SQL Views


Message #1 by gbrown@c... on Tue, 14 Nov 2000 15:01:50 -0000
Gram, actually you can use VFP with ADO.

Go to msdn.Microsoft.com and do a search for "vfp ado".  It will return
23 matches, several of which describe in detail how to use and ADO
recordset object with a VFP view.

I am not a VFP guy, but I did run into this a year ago with a VFP
programmer.  He said the same thing, then I showed him how it can be
done.

Once you get VFP to use ADO, you should be set...

-----Original Message-----
From: graham brown [mailto:gbrown@c...]
Sent: Friday, November 17, 2000 7:46 AM
To: sql language
Subject: [sql_language] RE: Help with SQL Views

Thanks for taking the time to reply.

What I'm trying to achieve is to page the data in the view.

So what I want to do is SELECT * FROM CUSTOMERS   process the first 100
records, then the next 100 records with something like SELECT NEXT 100

The only way I can see to do this is to use the "FetchAsNeeded" and
"FetchSize" like this

create myview as select * from customers
cursorsetprop("myview","view","fetchasneeded",.t.)
cursorsetprop("myview","view","fetchsize",100)
use myview
browse

This code is sort of visual foxpro ish so it may not translate well.
What it
does is show me the first 100 records as I browse through the file it
then
does a progressive fetch in the background of the next 100 so I get 200
records in the view, then 300 and so on.
What I want to end up with is always to have 100 records but like pages
of a
book.

In ADO this code is something like

myview=3Dcreateobject("adodb.recordset")
myview.pagesize=3D100
myview.absolutepage=3D1
myview.open "select * from customers"
if I then want to get the next 100 records of the view I just code
myview.absolutepage=3Dmyview.absolutepage +1

If I want to go to record 1000 of the view I can set absolutepage to 10
and
so on.

I can't use ADO in vfp as you can only have odbc or visfox tables in the
designers.

This what I'm trying to achieve am I stuck with progressive fetches
though.

Any more clues please !!

Graham Brown
Computer Software Services

gbrown@c...
http://www.compsys.co.uk
----- Original Message -----
From: Michael Morisoli <Michael@M...>
To: sql language <sql_language@p...>
Sent: Thursday, November 16, 2000 9:34 PM
Subject: [sql_language] RE: Help with SQL Views


> How about using:
> Select Top <n>
> <field 1>,
> <field 2>,
> <field 3>
> >From <my table>
> Order By
> <field xx>
>
> The phrase "top <n> will return only <n> rows for any select
statement.
>
>
> -----Original Message-----
> From: gbrown@c... [mailto:gbrown@c...]
> Sent: Tuesday, November 14, 2000 7:02 AM
> To: sql language
> Subject: [sql_language] Help with SQL Views
>
> Hi all
>
> I'm using Visual Foxpro to access SQL databases via views
> So  Create view mydata as select * from customers
> would return 30,000 records in about 3 weeks time.
> If I was to use ADO I can set a pagesize and an absolute page. This
> means
> that I can show the client 30,000 records if they really want to but
in
> smaller blocks.
> I know I can use a where clause in the select statement and make the
> view
> parameterised but there is still the possibility that the client can
set
> a
> huge select running.
>
> Is there anything with views which does the same thing as ADO paging.
> I've
> seen a property of the view called fetchsize but this just appears to
> stop
> when this number of records has been reached, I don't think I can tell
> it
> to fetch the next block with this.
>
> If anybody knows the answer I'd appreciate some pointers.
>
> Regards
> Graham Brown
> gbrown@c...
> http://www.compsys.co.uk
>
>
>
>

  Return to Index