Hello
Teachers
I create a project in vb.net 2010 with access database. I want to show data in listview. It Is show in listview but a problem I entry Id wise. So, when I click on the show data button I see the Id . How to show the id wise actual data.

I use the code for data load in listview1

Public Sub Displayitem()
        ListView1.Items.Clear()
        Dim cmd As New OleDb.OleDbCommand("SELECT * FROM pur_inv ORDER BY purinvdt", cn)
        Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader()

        Do While dr.Read()
            Dim new_item As New  _
     ListViewItem(dr.Item("purinvdt").ToString)
            new_item.SubItems.Add(dr.Item("purinvid").ToString)
            new_item.SubItems.Add(dr.Item("prtid").ToString)

            new_item.SubItems.Add(dr.Item("invtypid").ToString)
            new_item.SubItems.Add(dr.Item("taxamt").ToString)
            new_item.SubItems.Add(dr.Item("tottaxblamt").ToString)
            new_item.SubItems.Add(dr.Item("invamt").ToString)
            ListView1.Items.Add(new_item)
        Loop
    End Sub

I can't see anything wrong with the code you are sharing. So, what's the problem? Can you explain a bit further?

"Inv. Type" column in listview show the number(id of invoice type 2,3...) but I want to see here invoice type means (u002 or u003 .......)

If you mean to select a concrete id, you could do the following. When invtypid is -1, all the ids will be shown (on load event); when > -1 that only id will be shown (when button is clicked):

    Public Sub Displayitem(Optional invtypid As Int32 = -1)

        Dim da As New OleDbDataAdapter("SELECT * FROM pur_inv ORDER BY purinvdt", cn)
        Dim ds As New DataSet
        da.Fill(ds, "myTable")
        Dim dt As DataTable = ds.Tables("myTable")

        Dim q() As DataRow
        If invtypid = -1 Then
            q = (From r In dt.AsEnumerable Select r).ToArray
        Else
            q = (From r In dt.AsEnumerable _
                 Where r.Item("invtypid") = invtypid _
                 Select r).ToArray
        End If

        ListView1.Items.Clear()
        For Each dr As DataRow In q
            Dim new_item As New  _
                 ListViewItem(dr.Item("purinvdt").ToString)
            new_item.SubItems.Add(dr.Item("purinvid").ToString)
            new_item.SubItems.Add(dr.Item("prtid").ToString)

            new_item.SubItems.Add(dr.Item("invtypid").ToString)
            new_item.SubItems.Add(dr.Item("taxamt").ToString)
            new_item.SubItems.Add(dr.Item("tottaxblamt").ToString)
            new_item.SubItems.Add(dr.Item("invamt").ToString)
            ListView1.Items.Add(new_item)
        Next
    End Sub

Of course, if not present, you should add a reference to System.Linq.

it is show same result
in inv type column show the inv type not inv id

in the column where show the "2" in this place show "U002"

Then change invtypid by invtyp:

Public Sub Displayitem()
        ListView1.Items.Clear()
        Dim cmd As New OleDb.OleDbCommand("SELECT * FROM pur_inv ORDER BY purinvdt", cn)
        Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader()

        Do While dr.Read()
            Dim new_item As New  _
     ListViewItem(dr.Item("purinvdt").ToString)
            new_item.SubItems.Add(dr.Item("purinvid").ToString)
            new_item.SubItems.Add(dr.Item("prtid").ToString)

            new_item.SubItems.Add(dr.Item("invtyp").ToString)
            new_item.SubItems.Add(dr.Item("taxamt").ToString)
            new_item.SubItems.Add(dr.Item("tottaxblamt").ToString)
            new_item.SubItems.Add(dr.Item("invamt").ToString)
            ListView1.Items.Add(new_item)
        Loop
    End Sub

Then change invtypid by invtyp:

invtyp field not avalable in the table pur_inv.

it is differant table (name: inv_type, here two column a> invtypid b> invtyp)

pur_inv table has 10 column "invtypid" one of them, here entry only "invtypid" from inv_type table.

Now i want to that read the "invtypid" from listview column "Inv. Type" and convert to "invtyp" in the same place

Well, both tables must be read. You may code something like:

    Public Sub Displayitem()

        Dim cmd As New OleDb.OleDbCommand("SELECT * FROM pur_inv,inv_type WHERE pur_inv.invtypid=inv_type.invtypid ORDER BY purinvdt", cn)
        Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader()

        ListView1.Items.Clear()
        Do While dr.Read()
            Dim new_item As New  _
                     ListViewItem(dr.Item("purinvdt").ToString)
            new_item.SubItems.Add(dr.Item("purinvid").ToString)
            new_item.SubItems.Add(dr.Item("prtid").ToString)

            new_item.SubItems.Add(dr.Item("pur_inv.invtypid").ToString)
            new_item.SubItems.Add(dr.Item("taxamt").ToString)
            new_item.SubItems.Add(dr.Item("tottaxblamt").ToString)
            new_item.SubItems.Add(dr.Item("invamt").ToString)
            ListView1.Items.Add(new_item)
        Loop
    End Sub

Hay! Done it
I change and replace this line it is done! just I want

 new_item.SubItems.Add(dr.Item("pur_inv.invtypid").ToString)

to

new_item.SubItems.Add(dr.Item("invtyp").ToString)

thanks many many thinks.
God helpe you.

How Many table read at a time.... because want to same work index number column 2 mens (column name Party Name) can I Used for this "and" or ";" or ","

hello I do it
DONE!
Intelligence a God gifted quality
You are intelligence.

Thanks to you again for your confidence.