Sunday, 1 September 2013

loadind data to listview in vb.net 2008

loadind data to listview in vb.net 2008

I have two tables 1.[Mobilization]-Primary key is [Fen_Inovoice_No] it is
the forgien key is of [invovoice details] 2.[invovoice details] the
primary keys are [Fen_Inovoice_No],[Item] when I tried to view the data ,
the all data are not loading to listview why is that? { Private Sub
viewItem1(ByVal invoice_no As String)
myConnection = New SqlConnection(connectionstring)
myConnection.Open()
sqlcmd = New SqlCommand("SELECT Item,Quantity,Descrption ,Amount FROM
[invovoice details] where Fen_Inovoice_No='" & invoice_no & "' ",
myConnection)
sqlcmd.ExecuteNonQuery()
' Dim dr As SqlDataReader = myCommand1.ExecuteReader
Dim dr As SqlDataReader = sqlcmd.ExecuteReader
dr.Read()
' pr = dr1("Category").ToString
''''''''''''''''''''''''
' For i = 0 To TempData.Rows.Count-1
Dim newItem1 As New ListViewItem(dr.Item("Item").ToString)
newItem1.SubItems.Add(dr("Descrption").ToString)
newItem1.SubItems.Add(dr("Quantity"))
newItem1.SubItems.Add(dr("Amount"))
ListView1.Items.Add(newItem1)
' newItem.SubItems.Add()
CalTotal()
dr.Close()
'''''''''''''''''''''''''''''
myConnection.Close()
End Sub
'''''''''''''''''''''''''''''''''' Private Sub CalTotal() Dim TotalSum As
Double = 0 Dim TempNode As ListViewItem Dim TempDbl As Double For Each
TempNode In ListView1.Items If
Double.TryParse(TempNode.SubItems.Item(3).Text, TempDbl) Then
End If
TotalSum += TempDbl
Next
TextBox11.Text = TotalSum
End Sub
}

No comments:

Post a Comment