Restricting number of records to be loaded to DataSet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am using DataSets and DataAdapters generated by VS in my project, but i
cant find any way how to force such generated adapters not to load only all
records retuned by query into given DataSet (i need to avoid situations when
too many records matchind searching conditions and could lead to memory
overloading or stumping user with horde of records).
What would i need is to call DataAdapter.Fill method with parameter
maxRecords specified. It looks that there is not any support for design-time
created adapters to do this... (Best would be to override generated adapters'
Fill method, but it is not virtual one...)

Is there any way to achieve this while still using design support for
adapters and datasets?

Thanks for any idea
 
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE) or WHERE (which you can do in designers).

You can execute separate query with COUNT to find out how many records to
expect (which you need to code manually).



Alternatively you could switch to DataReader which allows you to read
records one by one and stop at any time.




--
Best regards,



Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE)
TOP would be nice simple solution if it was available on CE.
or WHERE (which you can do in designers).
Is it possible to refer to row order in result? I mean then i could do
something like this: select ... where ... and [row_order] < 1234
 
I don't believe there's such thing as "row order".



--
Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

Michal Rizek said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE)
TOP would be nice simple solution if it was available on CE.
or WHERE (which you can do in designers).
Is it possible to refer to row order in result? I mean then i could do
something like this: select ... where ... and [row_order] < 1234





Ilya Tumanov said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE) or WHERE (which you can do in designers).

You can execute separate query with COUNT to find out how many records to
expect (which you need to code manually).



Alternatively you could switch to DataReader which allows you to read
records one by one and stop at any time.




--
Best regards,



Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Have you thought about using the DataView class to handle this?

Regards
Simon.

Michal Rizek said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE)
TOP would be nice simple solution if it was available on CE.
or WHERE (which you can do in designers).
Is it possible to refer to row order in result? I mean then i could do
something like this: select ... where ... and [row_order] < 1234





Ilya Tumanov said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE) or WHERE (which you can do in designers).

You can execute separate query with COUNT to find out how many records to
expect (which you need to code manually).



Alternatively you could switch to DataReader which allows you to read
records one by one and stop at any time.




--
Best regards,



Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Ilya said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE) or WHERE (which you can do in designers).

why isn't the TOP clause available on SqlServer Mobile?

On a device whose resources are so limited, it would be VERY helpful.

Marcantonio
 
Have you thought about using the DataView class to handle this?

This solves problem with diplaying too many records, but it doesn't solve
problem with memory overload, all records are always loaded into dataset...

Simon Hart said:
Have you thought about using the DataView class to handle this?

Regards
Simon.

Michal Rizek said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE)
TOP would be nice simple solution if it was available on CE.
or WHERE (which you can do in designers).
Is it possible to refer to row order in result? I mean then i could do
something like this: select ... where ... and [row_order] < 1234





Ilya Tumanov said:
You should restrict number of records in query, e.g. by using TOP (not
available on SQL CE) or WHERE (which you can do in designers).

You can execute separate query with COUNT to find out how many records to
expect (which you need to code manually).



Alternatively you could switch to DataReader which allows you to read
records one by one and stop at any time.




--
Best regards,



Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

Hi,
I am using DataSets and DataAdapters generated by VS in my project, but
i
cant find any way how to force such generated adapters not to load only
all
records retuned by query into given DataSet (i need to avoid situations
when
too many records matchind searching conditions and could lead to memory
overloading or stumping user with horde of records).
What would i need is to call DataAdapter.Fill method with parameter
maxRecords specified. It looks that there is not any support for
design-time
created adapters to do this... (Best would be to override generated
adapters'
Fill method, but it is not virtual one...)

Is there any way to achieve this while still using design support for
adapters and datasets?

Thanks for any idea
 
Back
Top