How to imitate JDBC ResultSet.absolute?

  • Thread starter Thread starter John Urberg
  • Start date Start date
J

John Urberg

I'm porting some Java code that uses JDBC to C#. One of the methods
allows you to start at a relative position in a result set and return n
rows. Here's some of that code:

Collection LoadResults(ResultSet rs, int start, int rows) {
int count = 0;
rs.absolute(start);
while (rs.next()) {
if (++count > rows) break;
<load data into results collection>
}
return results;
}

In my converted code, I would like to load the results of the SQL
select into a DataSet, starting at row "start" and only loading "rows"
number of rows.

How would I do this in C#?

Thanks,
John
 
I found the answer: The Fill method on the DataAdapter classes has an
override that allows start and number of rows. So I just need to do
this:

adapter.Fill(ds, start, rows, tableName);
 
Back
Top