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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with ADO and unidirectional

Status
Not open for further replies.

morfasie

IS-IT--Management
Mar 28, 2004
85
ZA
hi all,

I have a problem. I retrieve data from adoquery and then set a datasource dataset to the adoquery. then I set the datasource of a dbgrid to the datasource itself.

if the adoquery has the cursorlocation set to : cluseclient, then everything works well, but if I set the cursorlocation to cluseserver, it says : you cannot do this operation on a unidirectional dataset.

why7 is that?

I want to use the "cluseserver" because it is so much faster?

any help please?

thanks
 
I've never used ADOQuery but I guess the following applies as much to ADOQuery as it does to dbExpress which I use a lot.

A DBGrid needs a bi-directional dataset. When you think about it the dataset must be bi-directional to enable the grid to scroll records in both directions.

A uni-directional dataset is much faster but the price you pay is that you cannot reverse direction. All you can do is get the next record or go to the start of the dataset. So a uni-directional dataset is unsuitable for a grid.

clUseClient probably uses a Client Dataset which is bi-directional. The data is stored in RAM.

clUseServer is probably a uni-directional dataset and is read from disk.

The Client Dataset has to get all the records from the uni-directional dataset before they can be displayed on the grid. This is why it is slower.

Andrew
Hampshire, UK
 
thanks for the reply,


is there then any other way to display information like a dbgrid, but without a dbgrid? or hwat should I do now?

 
There are probably some commercial equivalents of TDBGrid but they will have the same problem: they will need to buffer up records which takes time.

If it really is taking too long to display the records in your TDBGrid then maybe your query is selecting too many records in the first place.

I don't know which DBMS you are using but it might be worth looking around for a faster one. I use MySQL because I find it fast, reliable, scalable, has the functionality I want and is free.

Andrew
Hampshire, UK
 
Hi thanks man,

I am using MySQL, and delphi 2006.

The thing is, I am searching for people in my database and then populate the dbgrid with the results, so the person using the system, can then select the person in the dbgrid and it loads another page then.

So I don't know how to do it without dbgrid?

 
If you are getting very slow performance with MySQL then check that your tables are correctly indexed.

The usual way to handle your requirement is to use a DBGrid. If your table contains a large number of records you might consider limiting the number of records that each SELECT statement can retrieve. For example:
Code:
SELECT * FROM people WHERE name LIKE 'morf%' LIMIT 100
The system would tell the user to refine his search further if the SELECT returns 100 or more records.

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top