469,579 Members | 1,830 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

How to fill the datatable without using the database?

i need to fill the datatable(datagridview) without using the database..
Here is my code.. But i cant able to fill the datatable
[CODE}
Public Sub CreateDatatable()
dtable = New DataTable("purchasedetails_table")

Dim column As DataColumn


column = New DataColumn()
column.DataType = System.Type.GetType("System.String")
column.ColumnName = "SNo"
column.ReadOnly = True
column.Unique = True
dtable.Columns.Add(column)

column = New DataColumn()
column.DataType = System.Type.GetType("System.String")
column.ColumnName = "Item_Name"
column.ReadOnly = True
column.Unique = True
dtable.Columns.Add(column)

column = New DataColumn()
column.DataType = System.Type.GetType("System.String")
column.ColumnName = "Req_Qty"
column.ReadOnly = True
column.Unique = True
dtable.Columns.Add(column)

column = New DataColumn()
column.DataType = System.Type.GetType("System.String")
column.ColumnName = "Req_Date"
column.ReadOnly = True
column.Unique = True
dtable.Columns.Add(column)

dset = New DataSet()
dset.Tables.Add(dtable)


End Sub

Public Sub FillDatatable()
Dim row As DataRow
Dim i As Integer
For i = 0 To DataGridView1.Rows.Count - 1
row = dtable.NewRow()
row("SNo") = i + 1
row("Item_Name") = "Item_Name" + i.ToString()
row("Req_Qty") = "Req_Qty" + i.ToString()
row("Req_Rate") = "Req_Date" + i.ToString()
dtable.Rows.Add(row)
Next i
End Sub
[/CODE}
Aug 24 '10 #1
0 1089

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by fiaolle | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.