About SqlCeDataReader

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

if i use SqlCeDataReader to read SQLCE data, but can not display first row record???
{
Dim ListViewItem1 As New ListViewIte
Dim subItem1 As New ListViewItem.ListViewSubIte

Dim tmpReader As SqlCeDataReade
Dim sqlCmd As New SqlServerCe.SqlCeCommand("SELECT Barcode,Qty FROM PullCE Order by Barcode", connCE

tmpReader = sqlCmd.ExecuteReade

Listvar.FullRowSelect = Tru
Listvar.Clear(
Listvar.Columns.Add("Barcode ", 130, HorizontalAlignment.Center
Listvar.Columns.Add("Qty ", -2, HorizontalAlignment.Center

If tmpReader.Read = True The

While tmpReader.Read(

ListViewItem1 = New ListViewIte
ListViewItem1.Text = tmpReader("Barcode"

subItem1 = New ListViewItem.ListViewSubIte
subItem1.Text = tmpReader("Qty").ToStrin

ListViewItem1.SubItems.Add(subItem1
Listvar.Items.Add(ListViewItem1

ListViewItem1 = Nothin
subItem1 = Nothin

End Whil

End I
Listvar.View = View.Detail

tmpReader = Nothin
connCE.Close(


what wrong in this code?????
 
Take out your line If tmpReader.Read = True

This is advancing the position so when you start the while loop, you are
already in the second position.
J said:
Hello,

if i use SqlCeDataReader to read SQLCE data, but can not display first row record????
{
Dim ListViewItem1 As New ListViewItem
Dim subItem1 As New ListViewItem.ListViewSubItem


Dim tmpReader As SqlCeDataReader
Dim sqlCmd As New SqlServerCe.SqlCeCommand("SELECT Barcode,Qty
FROM PullCE Order by Barcode", connCE)
 
Back
Top