ADO.NET Multiple simultaneous reads from an open database.
- by Deverill
Answer not needed - my logic was wrong and this question is invalid. Charles helped me see where I went off-tracks. Thanks
I have a utility that moves data from one source to another. In the process of writing the record I check to see if it exists and do an update/insert as necessary. The difficulty I have is that as I'm writing the main record info there is a 2nd table for "custom data" that I have to check to see if it exists and do an update/insert for that as well.
Example:
I may be loading a pencil sharpener that may or may not exist. While I'm writing it into destination it has characteristics such as style, color, etc. and each of them may or may not exist.
As written I seem to need to have 2 DataReaders open, one for the sharpener and one to check for and update color.
I am new to ADO.NET, but not to programming and it's more complicated than I listed but for sanity's sake I didn't put all the details.
My question is: What am I missing? You can't have 2 readers open at the same time on a connection, yet I can't close the first if I'm stepping through all products. It seems inefficient to have 2 connections, readers, etc. for this. Is there a feature of ADO.NET DBs that I'm missing? How would you do it?
Thanks!