Dataset from a Dataset ?

L

luqman

I have One Dataset with Invoice Data for 5 Customers.

I have 5 GridView Controls, and I want to display each Customer Records in
each GridView, how can I ?

Can I create a dataset from existing Dataset for each customer, so that I
can set the datasouce of gridview controls or anything similar.

Any idea please ?

Best Regards,

Luqman
 
M

Mark Rae [MVP]

I have One Dataset with Invoice Data for 5 Customers.

I have 5 GridView Controls, and I want to display each Customer Records in
each GridView, how can I ?

Can I create a dataset from existing Dataset for each customer, so that I
can set the datasouce of gridview controls or anything similar.

DataSet MyDS = <however you create your DataSet>;

MyDS.Tables[0].DefaultView.RowFilter = "CustomerID = 1";
MyGridView1.DataSource = MyDS.Tables[0].DefaultView;
MyGridView1.DataBind();

MyDS.Tables[0].DefaultView.RowFilter = "CustomerID = 2";
MyGridView2.DataSource = MyDS.Tables[0].DefaultView;
MyGridView2.DataBind();

Etc...
 
L

luqman

Thanks very much, Mark, you really solved my problem.

Take care!

Luqman

Mark Rae said:
I have One Dataset with Invoice Data for 5 Customers.

I have 5 GridView Controls, and I want to display each Customer Records in
each GridView, how can I ?

Can I create a dataset from existing Dataset for each customer, so that I
can set the datasouce of gridview controls or anything similar.

DataSet MyDS = <however you create your DataSet>;

MyDS.Tables[0].DefaultView.RowFilter = "CustomerID = 1";
MyGridView1.DataSource = MyDS.Tables[0].DefaultView;
MyGridView1.DataBind();

MyDS.Tables[0].DefaultView.RowFilter = "CustomerID = 2";
MyGridView2.DataSource = MyDS.Tables[0].DefaultView;
MyGridView2.DataBind();

Etc...
 
L

luqman

Hi,

Just one question left, can I distinctly get the CustomerID from Dataset for
5 Customers, to fill in a Combo List, just 5 CustomerIDs from Invoice
Dataset ?

Just like this query : Select distinct CustomerID from InvoiceTable

Any idea please ?

Best Regards,

Luqman



luqman said:
Thanks very much, Mark, you really solved my problem.

Take care!

Luqman

Records
that
I
can set the datasouce of gridview controls or anything similar.

DataSet MyDS = <however you create your DataSet>;

MyDS.Tables[0].DefaultView.RowFilter = "CustomerID = 1";
MyGridView1.DataSource = MyDS.Tables[0].DefaultView;
MyGridView1.DataBind();

MyDS.Tables[0].DefaultView.RowFilter = "CustomerID = 2";
MyGridView2.DataSource = MyDS.Tables[0].DefaultView;
MyGridView2.DataBind();

Etc...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top