Adding a DataTable to a DataSet

Posted On // Leave a Comment

Dim customerOrders As DataSet = New DataSet("CustomerOrders")

Dim ordersTable As DataTable = customerOrders.Tables.Add("Orders")

Dim pkOrderID As DataColumn = ordersTable.Columns.Add( _
    "OrderID", Type.GetType("System.Int32"))
ordersTable.Columns.Add("OrderQuantity", Type.GetType("System.Int32"))
ordersTable.Columns.Add("CompanyName", Type.GetType("System.String"))

ordersTable.PrimaryKey = New DataColumn() {pkOrderID}
sumber : http://msdn.microsoft.com

0 komentar: