How can I filter a recordset on the server and not localy?
I use DataEnvironment (VB6) which returns some recordsets. I want to show the data on a data report but I want to display only the data that satisfy some criteria. I use the filter command:
let's say that the returning recordset from the data environment (deMyEnvironment) is: rsMyRecordset
deMyEnvironment.rsMyRecordset.filter = " Number > 30 "
My database (SQL Server 6.5) is very large and the problem is that my program loads all the database in memory, then it executes the query, displays the data I want in a report and only after the program ends, the memory is released. Is that a problem of data environment, of data report or mine? Can I use another way of filtering the data not localy but on the server?
Thank you!
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
Re: How can I filter a recordset on the server and not localy?
You can always use an sql query eg.
rst.Open "SELECT * FROM mytable WHERE Number > 30"
ASAIK are queries executed on the server, and this way you only get the records that match the criteria.
And use indices...
Crazy D @ Work :-)
Re: How can I filter a recordset on the server and not localy?
What is 'indices'? Do you have experience with data environment and data report?
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
Re: How can I filter a recordset on the server and not localy?
Indices is more then one index in a database. This helps to speed up queries in the database, especially usefull in large databases.
I only used the dataenvironment and the datareport once. I've used it to show only one record, in code I changed the query of the commandobject... don't think I can help you much with that, but I could easily create an sql query in the dataenvironment, so if you only want to show all records that match the criteria (Number > 30) I'd use a query for that.
Maybe someone else has more experience with the dataenvironment (we usually use crystal reports...)
Crazy D @ Work :-)