Is it possible to update records when read by an SqlReader object?

R

Rico Alexander

If not, how do you update records that you're reading in a sequence when
using vb.net?
 
W

William Ryan

The short answer is that you can't, but I'll qualify that. You can use one
connection to read a sequence of records, and then as you are reading them,
use another connection and command object to update the database. I can't
think of a scenario where this would be a desirable solution b/c if you
needed to read records to change them, you could do the whole thing with
T-SQL/PL-SQL etc.

Anyway, the DataAdapter updates records sequentially, but I'm not sure what
your ultimate goal is, so I don't want to lead you down the wrong direction.

So, you could use a DataReader and create a collection of someObjects that
mirror your SQL Query. Then, you can iterate through your collection and
use it coupled with some update logic and fire the updates sequentially.
Perhaps if you could let me know a little more of what you want to
accomplish, I could be of more assistance.

Let me know.

Bill
 

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,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top