Re: Pre-filtering datasets

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Sam.

Is it needed that you work completely disconnected. Otherwise I would in
your case file a dataset for every customer using the Where clause in the
Select.

The advantage is not only speed. Avoiding concurrency problems is a much
important deal in this, however.

I hope this helps,

Cor

"Sam" <sam@xxxxxxxxxx> schreef in bericht
news:121baf22p1ilpd7@xxxxxxxxxxxxxxxxxxxxx
I am having a very difficult time with the fill statement for datasets.
The fill will always obtain all records. I have a master-detail structure
in my forms and it's ridiculous to see that loading all the records in the
detail table occurs. The filter property only filters after I have
obtained all the data when the form loads. I have done the following:

private void Customer_Load(object sender, EventArgs e)
{
//Select statments in the table adapters contain where clause of '1=0' so
I load zero records initially for the datasets
this.customerTableAdapter.Fill(this.DataSet1.customer);
this.orderTableAdapter.Fill(this.DataSet1.order);
this.orderdetailTableAdapter.Fill(this.DataSet1.orderdetail);

this.employeeTableAdapter.Fill(this.DataSet1.employee);
getCustomer("33d489a7-b1b9-487d-a5ce-0072471482ba");

}
private void getCustomer(string customer_customer_id)
{
this.customerTableAdapter._adapter.SelectCommand.CommandText = "select *
from customer where customer_customer_id = '"+ customer_customer_id +"'";
this.customerTableAdapter.Fill(this.DataSet1.customer);
getOrders(customer_customer_id);
}
private void getOrders(string order_customer_id)
{
this.orderTableAdapter._adapter.SelectCommand.CommandText = "select * from
[order] where order_customer_id = '" + order_customer_id + "'";
this.orderTableAdapter.Fill(this.DataSet1.order);
}

The initial fills above are actually based on a dummy query that I use
with a where clause that is '1=0'. I use the dummy query to load 0 records
initally. Then I proceed to fill the dataset with only one record at a
time. The above code also forces me to make the _adapter public in the
designer.cs class which is also very annoying. Is there any way to get
the master-detail relationship to actually obtain only related records for
performance reasons? Basically if I have a 1 million record customer
table and a 1 million record order table how do I build an efficient model
to get only the records I need on demand? I have tried the .Filter()
command and it does not pre filter from the datasource but rather on the
results.



.



Relevant Pages

  • Re: Aggregate Functions and Null
    ... > preserved table using WHERE clause, ... adding the outer rows, while the WHERE is applied after. ... If you filter in the ON clause, you'll end up with ALL rows from the ... e.g., when you join Customers LOJ Orders, and want to filter customers from ...
    (microsoft.public.sqlserver.programming)
  • RE: Passing Qry as part of Rpt DoCmd.OpenReport
    ... You are, by your description, trying to filter the output of the report. ... If you create a string that is a Where Clause without the word Where, ... And yes my data query is plain vanillia with no where clause only a single ...
    (microsoft.public.access.reports)
  • Re: How to summarize recordset...Select Distinct alternative?
    ... You can loop through this one to using Filter to easily do the first ... GROUP BY groups, it doesn't filter. ... are done on the grouped records in the SELECT clause. ... where FldPage contained "Page2". ...
    (microsoft.public.data.ado)
  • Re: Filter By Calculated Field
    ... If you mean the prompt string in the Having clause, ... You can filter the total in many different ways. ... FROM [UnionSeasonCount Query] ... SELECT DISTINCT Season, MailingListID ...
    (microsoft.public.access.queries)
  • Re: Form record filtering not working
    ... This combination of the OpenForm Where clause and the combo ... This kind of thing patches the form's Filter in between the stub of the SQL ... Allen Browne - Microsoft MVP. ... the account being filtered out actually still appears in the drop ...
    (microsoft.public.access.forms)