Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How I make a seek inside a cursor generated form SQLexec()

Status
Not open for further replies.

Xaplytz

Programmer
Jun 26, 2000
79
US
Thank everybody
I had other question?

I Works with cursors generated form SQLexec() and is working excellent.
But I would like to know how I can make a seek inside these cursors.

thank again
[sig][/sig]
 
Javier, as you know the SEEK and FIND commands require an index. Therefore, you could use those commands if, after creating the cursor with SQLEXEC, you make one or more index tags on the cursor.

For fairly small cursors (say, less than a few hundred records), you probably will get nearly as good performance using the LOCATE FOR command, which does not require indexes. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Well, I know little of applications that require seach over LARGE indexed cursor, for example, interactive search in grid. Instead I usually make Search form, where you enter one or more search fields, run query and it returns result into grid. In my search query number of rows in result usually limited to 200..1000 records because when user really search something, he/she do not need much of result rows because search criteria allows to find something quikly. With SQL server it works VERY well. In addition, I made Interactive search for SQL Server that works ok too without downloading of large cursor locally.
When you build applications for SQL Server, you need to think by completely another way. With SQL Server often query to server is better way than download large data to local machine and work with it locally further. This because users usually do not use 99.9% of these data.
[sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
That is the problem doesn’t allow my make the index after I set the properties of the cursor, only before.
And I don’t like the idea to make index each time a make a cursor, there is not other way to seek faster inside the cursor.
[sig][/sig]
 
I am using database views to connect to the sql table and right after i open the table i do my index on field tag field. It take a bit longer when i start the program but after that it works like a carm. I can use seek to my heart conent. Hope that help.

Paul
 
Paul, this is an advantage of views.
Javierp, if you decide to use views, you can open view with NODATA option, index it (this is very quick operation because view contains no records), and than use requery() to get data. Data will be indexed!
But I'm still thinking that retrieving large number of records from SQL servr is just bad approach or application architecture.
Anyway, you can use LOCATE without any indexes to find data. If cursor is not larger than 100000 records, you will have perfect speed. This is because data located locally - no data transfer through network when locating (compare to the file server applications).
Hope this helped.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
How can I search records the same way VFP do the
context sensitive help?

thanks
 
WhatHandle, this is a subject of another thread.
You can search around here or at Universal thread forum for classes and samples.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top