As a general guideline, when do you want to copy a value to a variable vs reading it directly from the database.
For example; I have a datareader giving me the response to a database query. There is a field called PersonID. I'm testing for all odd numbers and then writing those PersonID fields to a file and outputing them to a display.
Would you copy the PersonID value for the current record into a local variable before manipulating it or would you just us the datareader reference to it?
I was always told if you touch it more than once, then assign it to a variable. But this goes back many years ago. What would be a good guideline with ADO and .Net?
Bernie
For example; I have a datareader giving me the response to a database query. There is a field called PersonID. I'm testing for all odd numbers and then writing those PersonID fields to a file and outputing them to a display.
Would you copy the PersonID value for the current record into a local variable before manipulating it or would you just us the datareader reference to it?
I was always told if you touch it more than once, then assign it to a variable. But this goes back many years ago. What would be a good guideline with ADO and .Net?
Bernie