That sounds like a very reasonable workaround
--
Alex Feinman
---
Visit
http://www.opennetcf.org
"Aaron" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Since I couldn't get anything to work good, I just ordered my
> recordset and iterated till I got to a new value, when I did, I added
> that item to my listview and continued the process till EOF was
> reached.
>
> On Tue, 15 Mar 2005 20:03:47 -0600, Aaron <(E-Mail Removed)>
> wrote:
>
>>Ok, here goes...I need to populate a listview with my recordset, yet
>>there are multiple items with the same data, and since there is no
>>built in ADO support for DISTINCT, I have to devise some way to
>>populate my listview with only unique values. My first column is the
>>column that is visible to the user, the second column contains an ID
>>that is not visible to the user since I set the column width to 0. My
>>problem is iterating through the list and checking the ID field to
>>make sure it hasn't already been added, if it has, ignore and go to
>>the next recordset row. Can anyone help me with this? I assume there
>>is a much better way to do this. I tried posting on Peter's forum but
>>I don't often get responses or find a lot of people who have used
>>similar processes for a listview which seems to be one of the more
>>difficult things to use.
>>
>> Dim rsDept As New InTheHand.Data.Adoce.Recordset
>> Dim serviceID As Int32
>> Dim floor As String
>> Dim item As New ListViewItem
>> Dim i As Integer
>>
>> rsDept.Open("SELECT tblServices.Number, tblServices.ServiceID,
>>tblFloors.Floor FROM tblFloors INNER JOIN tblServices ON
>>tblFloors.FloorID = tblServices.FloorID WHERE tblServices.Number = " &
>>G_TICKET, cn)
>> If Not rsDept.EOF And Not rsDept.BOF Then
>> G_ACTIVATE = True
>> frmDeptFloorRoom.Instance().lstDeptFloorRoom.Clear()
>> rsDept.MoveFirst()
>> While Not rsDept.EOF
>> serviceID =
>>rsDept.Fields("ServiceID").Value().ToString()
>> floor = rsDept.Fields("Floor").Value()
>>
>> If
>>(frmDeptFloorRoom.Instance().lstDeptFloorRoom.SelectedIndices.Count >
>>0) Then
>> For i = 0 To
>>frmDeptFloorRoom.Instance().lstDeptFloorRoom.Items.Count
>> item =
>>DirectCast(frmDeptFloorRoom.Instance().lstDeptFloorRoom.Items(frmDeptFloorRoom.Instance().lstDeptFloorRoom.SelectedIndices.Item(1)),
>>ListViewItem)
>> If serviceID <> Convert.ToInt32(item) Then
>> 'Add floor from current record
>>
>>frmDeptFloorRoom.Instance().lstDeptFloorRoom.Items.Add(New
>>ListViewItem(New String() {floor, serviceID}))
>> End If
>> Next
>> Else
>>
>>frmDeptFloorRoom.Instance().lstDeptFloorRoom.Items.Add(New
>>ListViewItem(New String() {floor, serviceID}))
>> End If
>>
>> rsDept.MoveNext() 'get new values from next record
>> End While
>> Else
>> .
>> .
>> .
>> End If
>