1,105,538 Community Members

data is not showing

Member Avatar
Dili1234
Junior Poster
169 posts since Aug 2012
Reputation Points: -2 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 3 [?]
 
0
 

I have to 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?

  Dim intResponse As Integer

        intResponse = MsgBox("Please insert the invoice no", MsgBoxStyle.OkOnly)

        If intResponse = vbOK Then


            Try
                myConnection = New SqlConnection(connectionstring)
                myConnection.Open()


                myCommand2 = New SqlCommand("  SELECT Fen_Telephone_No,[Fen_VAT_No] ,[Date],[Fen_Fax_No] ,[Source_of_order] ,[Totalamount],[NBT_Value] ,[NBT_Amount] ,[VAT_Value] ,[VAT_Amount] ,[Grand_total] ,[Contract_Name],[Client_Name] ,[Moblization_Value],[Moblization_Percentage] FROM [Mobilization] where [Fen_Inovoice_No]='" & TextBox1.Text & "'", myConnection)
                Dim dr As SqlDataReader = myCommand2.ExecuteReader
                While dr.Read()
                    'Fen_Telephone_No
                    Debug.WriteLine(dr(0))
                    TextBox3.Text = dr(0).ToString
                    '[Fen_VAT_No]
                    Debug.WriteLine(dr(1))
                    TextBox2.Text = dr(1).ToString
                    '[Date]
                    Debug.WriteLine(dr(2))
                    DateTimePicker1.Value = dr(2).ToString
                    '[Fen_Fax_No]
                    Debug.WriteLine(dr(3))

                    TextBox4.Text = dr(3)
                    '[Source_of_order]
                    Debug.WriteLine(dr(4))
                    TextBox12.Text = Val(dr(4))
                    '[Totalamount]
                    Debug.WriteLine(dr(5))
                    TextBox11.Text = Val(dr(5))
                    '[NBT_Value]
                    Debug.WriteLine(dr(6))
                    TextBox10.Text = Val(dr(6))
                    '[NBT_Amount]

                    Debug.WriteLine(dr(7))
                    TextBox5.Text = Val(dr(7))
                    '[VAT_Value]
                    Debug.WriteLine(dr(8))
                    TextBox6.Text = Val(dr(8))
                    '[VAT_Amount]
                    Debug.WriteLine(dr(9))
                    TextBox7.Text = Val(dr(9))
                    '[Grand_total]
                    Debug.WriteLine(dr(10))
                    TextBox8.Text = Val(dr(10))
                    '[Contract_Name]
                    Debug.WriteLine(dr(11))
                    ComboBox1.Text = dr(11)
                    '[Client_Name]
                    Debug.WriteLine(dr(12))
                    ComboBox2.Text = dr(12)
                    '[Moblization_Value]
                    Debug.WriteLine(dr(13))
                    TextBox17.Text = Val(dr(13))
                    '[Moblization_Percentage]
                    Debug.WriteLine(dr(14))
                    TextBox9.Text = Val(dr(14))
                End While
                dr.Close()
                myConnection.Close()

            Catch err As Exception
                MsgBox(err.Message, MsgBoxStyle.Exclamation)
            End Try
            'list
        End If
        Call AppendItem1()
        Private Sub AppendItem1()
        myConnection = New SqlConnection(connectionstring)
        myConnection.Open()

        sqlcmd = New SqlCommand("SELECT Item,Quantity,Descrption ,Amount FROM [invovoice details] where  Fen_Inovoice_No='" & TextBox1.Text & "'   ", 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
Member Avatar
Reverend Jim
Noli mentula
5,453 posts since Aug 2010
Reputation Points: 761 [?]
Q&As Helped to Solve: 653 [?]
Skill Endorsements: 51 [?]
Moderator
Featured
 
0
 

Try changing

[Fen_Inovoice_No]='" & TextBox1.Text & "'"

to

[Fen_Inovoice_No]=" & TextBox1.Text

Without seeing your DDL I suspect that Fen_Inovoice_No is being stored as a number, in which case you do not need the single quotes.

Member Avatar
tinstaafl
Postaholic
2,012 posts since Jun 2010
Reputation Points: 559 [?]
Q&As Helped to Solve: 403 [?]
Skill Endorsements: 36 [?]
 
0
 

That's assuming of course that you've set the View property to Details

Member Avatar
Dili1234
Junior Poster
169 posts since Aug 2012
Reputation Points: -2 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 3 [?]
 
0
 

Reverend Jim what is DDL means?
tinstaafl what is the meaning of View property to Details

Member Avatar
Dili1234
Junior Poster
169 posts since Aug 2012
Reputation Points: -2 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 3 [?]
 
0
 

the Problem is only 1st data is being load to listview why is that?

Member Avatar
Reverend Jim
Noli mentula
5,453 posts since Aug 2010
Reputation Points: 761 [?]
Q&As Helped to Solve: 653 [?]
Skill Endorsements: 51 [?]
Moderator
Featured
 
0
 

DDL is the data definition language, or the command that you execute to create the table. An example of the DDL is

CREATE TABLE [dbo].[PDFStore](
    [FileName] [varchar](500) NOT NULL,
    [Contents] [varbinary](max) NULL,
 CONSTRAINT [PK_PDFStore] PRIMARY KEY CLUSTERED 
(
    [FileName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

In order to display the data in a listview you have to set it to view details (columnar data)

ListView1.View = View.Details

Normally this would be done at design time. I'm assuming you have already done this. In order to display all of the records returned from the query you will need a loop. An example is

Dim dr As SqlDataReader = sqlcmd.ExecuteReader

Do While dr.Read()
    ListView1.Items.Add(New ListViewItem({rdr("Item"), rdr("Description"), rdr("Quantity"), rdr("Amount")}))
Loop
Member Avatar
Dili1234
Junior Poster
169 posts since Aug 2012
Reputation Points: -2 [?]
Q&As Helped to Solve: 7 [?]
Skill Endorsements: 3 [?]
 
0
 

Thank you

Question Answered as of 7 Months Ago by Reverend Jim and tinstaafl
Koelald
Newbie Poster
1 post since Sep 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

This post is intersting about web development langauge

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article