V
Vanny
I tried to loop through the datareader to find some data elements one at the
time. The first time loop , it's fine. To avoid going to the database, I
reuse the same datareader to search for the next element. However, the 2nd
search starts from the place where I exit the loop, which causes the search
failed if the searched element is located before the first one. The
question is how could I make the loop start from row one again by using the
same datareader. Here how the code looks like for the search (strTempline is
the searched element which changes the value).
With drObject
If .HasRows Then
While .Read
If.Item("ref_id").ToString = strTempLine Then
strTableName = .Item("related_object").ToString
strTblRefId = strTempLine
blnExistRefid = True
Exit While
Else
blnExistRefid = False
End If
End While
End If
End With
Thanks for help
Vanny
time. The first time loop , it's fine. To avoid going to the database, I
reuse the same datareader to search for the next element. However, the 2nd
search starts from the place where I exit the loop, which causes the search
failed if the searched element is located before the first one. The
question is how could I make the loop start from row one again by using the
same datareader. Here how the code looks like for the search (strTempline is
the searched element which changes the value).
With drObject
If .HasRows Then
While .Read
If.Item("ref_id").ToString = strTempLine Then
strTableName = .Item("related_object").ToString
strTblRefId = strTempLine
blnExistRefid = True
Exit While
Else
blnExistRefid = False
End If
End While
End If
End With
Thanks for help
Vanny