G
Guest
Hi,
I'm using VS2003. I am trying to use the FindRows method to create something
with the returned rows that I can use as a datasource for a list box. I am
storing the returned rows of the FindRows in a DataRowView array. What can i
do to be able to change this into something I can use as a DataSource. (A
dataView for instance).
Here is the code:
DataView dv = new DataView(dsMaster.Customers);
string filterString = "CompanyName LIKE 'a%'";
DataRowView[] drv = dv.FindRows("CompanyName LIKE 'a%'");
// Create something to use as a Datasource// This doesn't work
DataView newView = new DataView();
// Iterate thru the array of rowViews
foreach (DataRowView rowView in drv)
{
newView.Table.Rows.Add(rowView); // must convert it somehow
filteredTable.Rows.Add( );
}
lstBox.DataSource = whateverKindOfDataSource;
Thanks for your help in advance
Ant
I'm using VS2003. I am trying to use the FindRows method to create something
with the returned rows that I can use as a datasource for a list box. I am
storing the returned rows of the FindRows in a DataRowView array. What can i
do to be able to change this into something I can use as a DataSource. (A
dataView for instance).
Here is the code:
DataView dv = new DataView(dsMaster.Customers);
string filterString = "CompanyName LIKE 'a%'";
DataRowView[] drv = dv.FindRows("CompanyName LIKE 'a%'");
// Create something to use as a Datasource// This doesn't work
DataView newView = new DataView();
// Iterate thru the array of rowViews
foreach (DataRowView rowView in drv)
{
newView.Table.Rows.Add(rowView); // must convert it somehow
filteredTable.Rows.Add( );
}
lstBox.DataSource = whateverKindOfDataSource;
Thanks for your help in advance
Ant