Private Sub MyShowBill()
Dim sqlQuery As String = " select Product, Amount, PriceBuy, PriceTotal from vwBill where idbill = '" & FrmCheckBill.idbill & "' "
Dim sqlDa As New SqlDataAdapter
Dim sqlComm As New SqlCommand
Dim Tablelvg As New DataTable
Dim sqlDs As New DataSet
With sqlComm
.CommandText = sqlQuery
.Connection = sqlConn
End With
sqlDa = New SqlDataAdapter(sql, cn)
sqlDs = New DataSet
sqlDa.Fill(Tablelvg)
For i = 0 To Tablelvg.Rows.Count - 1
With ListView1
.Items.Add(Tablelvg.Rows(i)("product")).ToString()
.Items.Add(Tablelvg.Rows(i)("Amount")).ToString()
.Items.Add(Tablelvg.Rows(i)("PriceBuy")).ToString()
.Items.Add(Tablelvg.Rows(i)("PriceTotal")).ToString()
End With
Next
end sub
Private Sub MyShowBill()
Dim sqlQuery As String = " select Product, Amount, PriceBuy, PriceTotal from vwBill where idbill = '" & FrmCheckBill.idbill & "' "
Dim sqlDa As New SqlDataAdapter
Dim sqlComm As New SqlCommand
Dim Tablelvg As New DataTable
Dim sqlDs As New DataSet
With sqlComm
.CommandText = sqlQuery
.Connection = sqlConn
End With
sqlDa = New SqlDataAdapter(sql, cn)
sqlDs = New DataSet
sqlDa.Fill(Tablelvg)
For i = 0 To Tablelvg.Rows.Count - 1
Dim arr As String() = New String(4) {}
Dim itm As ListViewItem 'add items to ListView
arr(0) = Tablelvg.Rows(i)("product").ToString()
arr(1) = Tablelvg.Rows(i)("Amount").ToString()
arr(2) = Tablelvg.Rows(i)("PriceBuy").ToString()
arr(3) =Tablelvg.Rows(i)("PriceTotal").ToString()
itm = New ListViewItem(arr)
listView1.Items.Add(itm)
Next
end sub