How do you manipulate records in an ADO.NET recordset?

  • Thread starter Thread starter Jodi Wedll
  • Start date Start date
J

Jodi Wedll

This question seems oversimplified to me, but I come from the land of
creating recordsets in old ADO in which I could cycle through each
record in the recordset and assign the values of the record to
controls, count the number of records in the recordset, etc. In the
new ADO.NET, I can only seem to create a dataset which I can set to a
datagrid. The information in the datagrid is correct, but I want to
be able to cycle through the records, read the the information in the
dataset which I created by running a query against a table, and
manipulate(read or change) as I see fit. I will tackle saving the
information back to the database in the next phase. From my
experience, this seems like a really simple question. Can anyone
inform me of how simple or how complicated it really is?
 
You can walk through a DataTable (0 or more of which comprise a DataSet).
Anyway, you can iterate through it like so...

foreach(DataRow dro in DataSet.Tables(TableIndex).Rows){

//Do your processing here
}

The closest object to the old way record sets often worked is a
datareader.IF you use it, you can only move forward through it and it'll
only work if you maintain the connection. With a DataTable, you can walk it
anyway you please, and you can also fire Select Statements against it (as
opposed to the database)

Hopefully this is what you are asking, but if not, let me know and I'll see
what I can do.

Cheers,

Bill
Jodi Wedll said:
This question seems oversimplified to me, but I come from the land of
creating recordsets in old ADO in which I could cycle through each
record in the recordset and assign the values of the record to
controls, count the number of records in the recordset, etc. In the
new ADO.NET, I can only seem to create a dataset which I can set to a
datagrid. The information in the datagrid is correct, but I want to
be able to cycle through the records, read the the information in the
dataset which I created by running a query against a table, and
manipulate(read or change) as I see fit. I will tackle saving the
information back to the database in the next phase. From my
experience, this seems like a really simple question. Can anyone
inform me of how simple or how complicated it really is?



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Back
Top