Hello everyone! This is my first time posting on this site, and it seems pretty impressive (top of the list from my google search!).
My question is this:
I have a DataReader that returns several rows - let's say hypothetically 30. The problem is that records 23-27 have been deleted.. I want to systematically read through a column from each row, and compare it against a value a user entered in a textbox. If a value matches what the user entered, I set the value in the textbox back to 0. Basically, I want this column to not be able to store duplicates (other then 0). The problem occurs when I attempt to read through the data and hit the rows that do not exist I believe, and I get the following error: InvalidOperationException occured, Invalid attempt to read when no data is present.
I can't check either to see if the DataReader.Item("columnName") has a value in it, or is nothing... it just throws the same error!
(My first guess was to do an If.. then... end if check to see if the column was not nothing, then proceed).
But for wahtever reason, everything I do ends up with the call to .Item("columnName") throwing that error.
Do you have any suggestions, vbdotnetforums people?
Thanks,
Daniel
My question is this:
I have a DataReader that returns several rows - let's say hypothetically 30. The problem is that records 23-27 have been deleted.. I want to systematically read through a column from each row, and compare it against a value a user entered in a textbox. If a value matches what the user entered, I set the value in the textbox back to 0. Basically, I want this column to not be able to store duplicates (other then 0). The problem occurs when I attempt to read through the data and hit the rows that do not exist I believe, and I get the following error: InvalidOperationException occured, Invalid attempt to read when no data is present.
I can't check either to see if the DataReader.Item("columnName") has a value in it, or is nothing... it just throws the same error!
(My first guess was to do an If.. then... end if check to see if the column was not nothing, then proceed).
But for wahtever reason, everything I do ends up with the call to .Item("columnName") throwing that error.
Do you have any suggestions, vbdotnetforums people?
Thanks,
Daniel