I've created a DataView in C#.
I've also sorted my records on product_name.
If I return 6000 products and want to get to products
(3000-3020) I wrote the following code:
WriteView(myView,3000,3020)
public void WriteView(DataView myView,int startIdx,int endIdx)
{
int n;
n=0;
myView.Sort="product_name";
foreach (DataRowView myDRV in myView)
{
n=n+1;
for (int i = 0; i < myView.Table.Columns.Count; i++)
{
if ((n > startIdx) && (n < endIdx))
{
Console.Write(myDRV[i] + "\t");
Console.WriteLine("");
}
}
}
When I run this it works but I wonder if I can get the same result
without having to scan through the DataView.
I've tried skipping over the first 3000 records using the command
Console.WriteLine(myView.Table.Rows[j][i]);
where j=3000 to 3020 but this does not return the sorted order; it
returns the DataView in the intial sequence that it was first fetched
from the dbase.
Does anyone have any other suggestions.
Thanks
J.C. Klay