William Vaughn
2/16/2008 2:45:00 AM
The DataTable has a DefaultView (DataView) that can be searched, filtered
and sorted. You can also use Linq to manage it as well.
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
"Vanny" <lim_v@bls.gov> wrote in message
news:uHsjd4AcIHA.4652@TK2MSFTNGP06.phx.gbl...
>I don't see how this load to the datatable relates to the search. Could
>you please explain more?
>
> Thanks,
> Vanny
>
> "William Vaughn" <billvaNoSPAM@betav.com> wrote in message
> news:%235B9Z$$bIHA.4844@TK2MSFTNGP04.phx.gbl...
>> This is easy. Load a DataTable with the DataReader stream.
>>
>> Dt.Load dr
>>
>> --
>> __________________________________________________________________________
>> William R. Vaughn
>> President and Founder Beta V Corporation
>> Author, Mentor, Dad, Grandpa
>> Microsoft MVP
>> (425) 556-9205 (Pacific time)
>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>> ____________________________________________________________________________________________
>> "Vanny" <lim_v@bls.gov> wrote in message
>> news:esnI$z9bIHA.748@TK2MSFTNGP04.phx.gbl...
>>>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
>>>
>>>
>>
>
>