S
Sam
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.
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.