![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query. An example query would be something like: Select * from invoices where year > 1995 the query must be updatable and only return say 10 to 100 rows at a time. It should also be forward only and discard rows no longer in use to save memory. |
#3
| |||
| |||
|
|
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query. An example query would be something like: Select * from invoices where year > 1995 the query must be updatable and only return say 10 to 100 rows at a time. It should also be forward only and discard rows no longer in use to save memory. And if at all possible I would like to lock one row at a time as the row is read in. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Great information on MARS and the ExecuteReader. What I am trying to do is to emulate a legacy product's data access method. The reason I am doing this is there is just way too much code to convert into proper sql. I'm talking at least 1 million lines of code. I have already written a conversion program to convert the code to VB.NET and now I must right a dll assembly to emulate the legacy data access. |
|
Here is one an example of what I have to emulate: get #3, key #1 GE "20060101" while invoiceDate < "20070101" ! The current row is now locked! ! make changes update #3 ! updates the currently locked row and now unlocked. get #3 ! read the next row in next The converted code looks something like: ' note: 3 = the registered table SQL.getGreaterEqual(3, "20060101") ' notice no upper bounds while invoiceDate < "20070101" ' The current row is now locked! ' make changes SQL.update(3) ' updates the currently locked row and now unlocked. SQL.getNext(3) ! read the next row in next My question now is: How do I lock one row at a time??? |
#6
| |||
| |||
|
|
I take it that the other product was using another data store than SQL Server? |

|
However, the only reasonable approach is optimistic locking. |
|
I can think of a third way: first read all keys into local array. Then iterate over the array, and read one row at a time as 1) Start transaction with REPEATABLE READ, 2) read row 3) update and 4) commit. But this will be slow as I don't know what. |
![]() |
| Thread Tools | |
| Display Modes | |
| |