In ASP.NET, I need to loop through all records from a table in MS Access and update the content. Below I've tried to use a DataReader in a similar way to a Recordset in classic ASP - but I'm getting an error that "There is already an open DataReader associated with this Connection". When I tried creating a second connection object, I got an error that the record was locked by another process.
--------------This is my non-working attempt -----------------
Dim oConn As OleDbConnection
oConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" ...)
Dim oCmd As OleDbCommand
oCmd = New OleDbCommand( "SELECT ContentID, PageText From tContent", oConn )
Dim oDR As OleDbDataReader
oDR = oCmd.ExecuteReader()
'loop through the database
Do While oDR.Read()
NewPageText="insert updated txt here" '-- this comes from a function
strSQL="UPDATE tContent SET PageText='" & NewPageText & "' WHERE ContentID=" & oDR("ContentID")
oCmd = New OleDbCommand( strSQL, oConn )
This seems like it should be a simple thing, but apparently not. Please give me a working example of looping through and updating a recordset in ASP.NET. Thanks!