Terrance,
There are three methods in Adonet to find records and they all create a
collection of datarows or a single datarow.
Only two will in my idea fit your problem those are
Datatable.select 'static filter
http://msdn.microsoft.com/library/de...electtopic.asp
Dataview.rowfilter 'the fastest and a dynamic filter
http://msdn.microsoft.com/library/de...ilterTopic.asp
After that you have to loop through the collection of course.
The third is the datarow.find however just for one row with the primary key.
I hope this helps,
Cor
"Terrance" <(E-Mail Removed)>
> Hello all, I have a problem I was hoping someone could help me out with.
Ok,
> in my Sql Server Database I'm searching through a table for a particular
> value that a user enters(e.g. nameid ). The problem is there are several
> nameid's in 1 row of data that I have to search and it's possible for that
> nameid to be located in more than 1 place in the table. In my listview
what
> I'm trying to do is have it where, if a user clicks on row the program
will
> search that row for that nameid and pull back the necessary picture. Note:
> the data in my listview contains all the rows where that nameid is
located.
> The reason why I had to bring back the other nameid' is because there are
> columns such nameid1, nameid2, and so on. In my code, I've been able to
> indicate the column id that he user double-click on but I can't cycle
> through each column to find the nameid without the code going through the
> first row. For example, If two records are returned and I double-click on
the
> second my code goes through the first row first due to a 'For Each' loop
that
> I'm using for the datarow. I hope I haven't made this too cofusing. Here
is
> some of the code:
>
> 'place the index of the choosen row into this variable
> Dim choosenRow As String =
> lvResult.SelectedItems(0).Text.ToString()
> 'variable to hold the current index as we
> 'loop through each row
> Dim tempString As String
>
> Do Until iCounter = mDataTable.Rows.Count
>
> tempString =
mDataTable.Rows(iCounter)("plineupid").ToString()
> CompareResult = String.Compare(choosenRow, tempString)
>
> If (CompareResult = 0) Then
> For Each myDataRow In
mDataSet.Tables("plineup").Rows()
> For iLoop = 0 To myDataRow.Table.Columns.Count() - 1
>
> If myDataRow.Item(iLoop) = txtSysid.Text Then
>
> Dim imageStream As System.IO.FileStream
>
> imageStream = New System.IO.FileStream
> (configClass.frmMDirectory & _
> "\" & myDataRow.Item(iLoop) & "." &
> myDataRow.Item(iLoop + 1), System.IO.FileMode.Open, _
> System.IO.FileAccess.Read)
> 'set the image for the picturebox to reduce or
> to expand
> 'to fit the size of the Picturebox.
> imgName.SizeMode =
PictureBoxSizeMode.StretchImage
> imgName.Image =
> System.Drawing.Image.FromStream(imageStream)
> Exit For
> End If
> Next
> 'Next
> Exit Do
> End If
>
> iCounter += 1 'increment iCounter variable
> Loop
>
> Please help....
> --
> TC