PDA

View Full Version : مبتدی: ارسال اطلاعات به دیتا تیبل



tto_baran
یک شنبه 10 اردیبهشت 1396, 20:32 عصر
سلام

بفرمایید چگونه میتوانم مقادیر مشخص a و b , c را به یک دیتا تیبل ارسال کنم

hamidrezax1
دوشنبه 11 اردیبهشت 1396, 18:25 عصر
منظورتون ذخیره توی دیتابیس هستش؟
یا توی گریدنمایش داده بشه؟

mmbguide
دوشنبه 11 اردیبهشت 1396, 23:27 عصر
MSDN


Private Sub MakeDataTableAndDisplay()
' Create new DataTable and DataSource objects.
Dim table As DataTable = New DataTable()


' Declare DataColumn and DataRow variables.
Dim column As DataColumn
Dim row As DataRow
Dim view As DataView


' Create new DataColumn, set DataType, ColumnName and add to DataTable.
column = New DataColumn()
column.DataType = System.Type.GetType("System.Int32")
column.ColumnName = "id"
table.Columns.Add(column)


' Create second column.
column = New DataColumn()
column.DataType = Type.GetType("System.String")
column.ColumnName = "item"
table.Columns.Add(column)


' Create new DataRow objects and add to DataTable.
Dim i As Integer
For i = 0 to 9
row = table.NewRow()
row("id") = i
row("item") = "item " & i
table.Rows.Add(row)
Next
' Create a DataView using the DataTable.
view = New DataView(table)


' Set a DataGrid control's DataSource to the DataView.
DataGrid1.DataSource = view
End Sub