possible to create an auto-increment column in datatable?

ashrobo

Well-known member
Joined
Apr 6, 2003
Messages
70
Location
Black Hole
howdy,
is it possible to create an auto-increment column in the datatable without getting the value from the database? i know it is possible to do so if the value is taken from the database but in my situation right now, i have retrieved the info i need from the database into the datatable. However, there is no relevant auto-increment column in the database and i want to include an auto number column in the datatable.

Code:
        query = "SELECT POQty.PONo AS [PO No], InvOrders.PartNo AS [Part No], " & _
            "POQty.Quantity AS [Quantity] " & _
            "FROM POQty INNER JOIN InvOrders ON POQty.InvoiceNo = InvOrders.InvoiceNo " & _
            "WHERE POQty.InvoiceNo = " & InvNo & ""
        Try
            daOrders.SelectCommand = New OleDbCommand(query, MyConnection)
            daOrders.Fill(dsOrders)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

a datagrid is bound to the datatable..
Code:
        grdOrders.DataSource = dsOrders.Tables(0)
the auto-increment column is for displaying the row number in the datagrid.

thanks in advance,
ashrobo
 
Cant you just instantiate a new column, set auto increment to true, and then add it to the DataTable?
 
Back
Top