M
Mike P
Hi,
I am using the ExecuteReader method from the Microsoft DAAB to return a
DataReader which I am iterating through to mainly read a binary value from
one of the returned columns. I am using this value as the raw data to render
a PDF document. After this is successful, I want to update the same record
with a timestamp to indicate the render to PDF was successful. However,using
a totally separate method in my code (using ExecuteNonQuery of the DAAB) to
do this whilst the reader is still open (using the pk of the row I want to
update), throws an exception - the call times out and if I look at the
processes in the database, the update of the timestamp is being locked by
the datareader process. My code is the only code accessing this table and
the column I am updating is not one of the ones returned by the datareader.
So now on to the questions:
1) Should I theoretically be able to read a row with a datareader and update
a column in the same row (using a separate connection/call) before moving on
to the next record?
2) If I cannot do this, what is the best and most efficient practice to
perform this kind of operation (I may have to do this for up to 30,000
rows)? Do I get a list of all the rows I want to operate on (in an array or
datatable) and then iterate through each one, pulling the relevant data back
for one row at a time in a disconnected fashion for each row and then
perform the update or should i just pull back all the records in a
disconnected fashion (this seems like it would work when there are a small
amount of rows but then if I have 30,000, that's going to be one very big
DataSet/DataTable?
Any help would be greatly appreciated
Thanks in advance
Mike
I am using the ExecuteReader method from the Microsoft DAAB to return a
DataReader which I am iterating through to mainly read a binary value from
one of the returned columns. I am using this value as the raw data to render
a PDF document. After this is successful, I want to update the same record
with a timestamp to indicate the render to PDF was successful. However,using
a totally separate method in my code (using ExecuteNonQuery of the DAAB) to
do this whilst the reader is still open (using the pk of the row I want to
update), throws an exception - the call times out and if I look at the
processes in the database, the update of the timestamp is being locked by
the datareader process. My code is the only code accessing this table and
the column I am updating is not one of the ones returned by the datareader.
So now on to the questions:
1) Should I theoretically be able to read a row with a datareader and update
a column in the same row (using a separate connection/call) before moving on
to the next record?
2) If I cannot do this, what is the best and most efficient practice to
perform this kind of operation (I may have to do this for up to 30,000
rows)? Do I get a list of all the rows I want to operate on (in an array or
datatable) and then iterate through each one, pulling the relevant data back
for one row at a time in a disconnected fashion for each row and then
perform the update or should i just pull back all the records in a
disconnected fashion (this seems like it would work when there are a small
amount of rows but then if I have 30,000, that's going to be one very big
DataSet/DataTable?
Any help would be greatly appreciated
Thanks in advance
Mike