Read and update a table

  • Thread starter Thread starter David
  • Start date Start date
D

David

Using VS2005, ASP.Net and SQL Server. What ADO command set do I need to
both read and update selected records in a table? I want to do something
with each one and then update a column on that record before moving to the
next record.

For example:
cmdSelectStaff = New OleDbCommand(strSQL, conFileData)

dtrStaff = cmdSelectStaff.ExecuteReader()

While dtrStaff.Read()

dtrStaff("column") = "xyz"

dtrStaff.Update



End While

I cannot find an .update method. Is there a different reader I should be
using? Thanks.

David
 
I have a few questions of my own:
1) If this is SQL Server why aren't you using the SqlClient provider?
2) If this is SQL Server why aren't you doing this UPDATE in place? Why
bring the rows to the client, work some logic and send them back updated?
This can all be done (in virtually all cases) on the server in a procedure
or simply in an UPDATE statement.
3) What lead you believe that this would work?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
Between now and Nov. 6th 2006 you can sign up for a substantial discount.
Look for the "Early Bird" discount checkbox on the registration form...
 
http://msconline.maconstate.edu/tutorials/ASPNET20/ASPNET09/aspnet09-10.aspx"David said:
Using VS2005, ASP.Net and SQL Server. What ADO command set do I need to both read and update selected records in a table? I want
to do something with each one and then update a column on that record before moving to the next record.

For example:
cmdSelectStaff = New OleDbCommand(strSQL, conFileData)

dtrStaff = cmdSelectStaff.ExecuteReader()

While dtrStaff.Read()

dtrStaff("column") = "xyz"

dtrStaff.Update



End While

I cannot find an .update method. Is there a different reader I should be using? Thanks.

David
 
Back
Top