Does anyone know if it is possible to add an id column to an existing datatable that autoincrements? I have tried, but the id column is null. I am filtering a cached datatable so the ids for the records will constantly change.
This is what I have tried...but NO LUCK! I get zero records, I would think I would get one. Thanks!
Sample code:
alphapagedt = CType(Session("AlphaResults", DataTable)
Dim c1 As New DataColumn("alphaid", Type.GetType("System.Int32")
c1.AutoIncrement = True
c1.AutoIncrementSeed = 1
alphapagedt = CType(Session("AlphaResults", DataTable)
alphapagedt.Columns.Add(c1)
alphapagedt.DefaultView.RowFilter = "alphaid=1"
dgSearch.DataSource = alphapagedt.DefaultView
dgSearch.DataBind()
This is what I have tried...but NO LUCK! I get zero records, I would think I would get one. Thanks!
Sample code:
alphapagedt = CType(Session("AlphaResults", DataTable)
Dim c1 As New DataColumn("alphaid", Type.GetType("System.Int32")
c1.AutoIncrement = True
c1.AutoIncrementSeed = 1
alphapagedt = CType(Session("AlphaResults", DataTable)
alphapagedt.Columns.Add(c1)
alphapagedt.DefaultView.RowFilter = "alphaid=1"
dgSearch.DataSource = alphapagedt.DefaultView
dgSearch.DataBind()