i am trying to read in a list of custmers from northwind database and add
them into a listbox,
the first 20 records add fine, but any records after that are duplicates of
the last record in the query.??
anyone else come across this?

using inTheHand.DLL with the following code:

Dim dr As AdoceDataReader
Dim cmd As New AdoceCommand("SELECT supplierID,companyname from suppliers
ORDER BY CompanyName ASC", conn)
Try
dr = cmd.ExecuteReader()
Dim startRec As Integer
startRec = (pagingNo * val) + 1
Dim c As Integer
c = 0
cboSuppliers.Items.Clear()
ListBox1.Items.Clear()
While dr.Read()
If c = val Then Exit While
ListBox1.Items.Add(dr(1))
cboSuppliers.Items.Add(dr(1))
c = c + 1
End While
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
dr = Nothing
cmd = Nothing
End Try

thanks,
Paul

Re: strange CDB data read problem... by Peter

Peter
Thu Nov 11 13:11:29 CST 2004

How is the value of "val" set in your code, it appears that this is used to
break from your while loop. also what is the startRec used for as it doesn't
seem to be used in the following code.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"Milsnips" <milsnips@hotmail.com> wrote in message
news:%23hIvqh%23xEHA.3224@TK2MSFTNGP14.phx.gbl...
>i am trying to read in a list of custmers from northwind database and add
> them into a listbox,
> the first 20 records add fine, but any records after that are duplicates
> of
> the last record in the query.??
> anyone else come across this?
>
> using inTheHand.DLL with the following code:
>
> Dim dr As AdoceDataReader
> Dim cmd As New AdoceCommand("SELECT supplierID,companyname from suppliers
> ORDER BY CompanyName ASC", conn)
> Try
> dr = cmd.ExecuteReader()
> Dim startRec As Integer
> startRec = (pagingNo * val) + 1
> Dim c As Integer
> c = 0
> cboSuppliers.Items.Clear()
> ListBox1.Items.Clear()
> While dr.Read()
> If c = val Then Exit While
> ListBox1.Items.Add(dr(1))
> cboSuppliers.Items.Add(dr(1))
> c = c + 1
> End While
> Catch ex As Exception
> MessageBox.Show(ex.Message)
> Finally
> dr = Nothing
> cmd = Nothing
> End Try
>
> thanks,
> Paul
>
>



Re: strange CDB data read problem... by Milsnips

Milsnips
Thu Nov 11 13:57:36 CST 2004

the val is just a integer limit to set how many records i want to return..
it acts as a counter which i set as a parameter of the Sub.


as for the startRec, this was some test code i forgot to remove.

thanks,
Paul.


"Peter Foot [MVP]" <feedback@no-spam.inthehand.com> wrote in message
news:ObNx#ICyEHA.2200@TK2MSFTNGP09.phx.gbl...
> How is the value of "val" set in your code, it appears that this is used
to
> break from your while loop. also what is the startRec used for as it
doesn't
> seem to be used in the following code.
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> www.inthehand.com | www.opennetcf.org
>
> "Milsnips" <milsnips@hotmail.com> wrote in message
> news:%23hIvqh%23xEHA.3224@TK2MSFTNGP14.phx.gbl...
> >i am trying to read in a list of custmers from northwind database and add
> > them into a listbox,
> > the first 20 records add fine, but any records after that are duplicates
> > of
> > the last record in the query.??
> > anyone else come across this?
> >
> > using inTheHand.DLL with the following code:
> >
> > Dim dr As AdoceDataReader
> > Dim cmd As New AdoceCommand("SELECT supplierID,companyname from
suppliers
> > ORDER BY CompanyName ASC", conn)
> > Try
> > dr = cmd.ExecuteReader()
> > Dim startRec As Integer
> > startRec = (pagingNo * val) + 1
> > Dim c As Integer
> > c = 0
> > cboSuppliers.Items.Clear()
> > ListBox1.Items.Clear()
> > While dr.Read()
> > If c = val Then Exit While
> > ListBox1.Items.Add(dr(1))
> > cboSuppliers.Items.Add(dr(1))
> > c = c + 1
> > End While
> > Catch ex As Exception
> > MessageBox.Show(ex.Message)
> > Finally
> > dr = Nothing
> > cmd = Nothing
> > End Try
> >
> > thanks,
> > Paul
> >
> >
>
>