Datatable add to dataset

前端 未结 1 1974
忘了有多久
忘了有多久 2021-01-29 15:29

i need to set a table to a dataset

DataSet ds = EventDal.GetEvents();
DataSet dsReturn = new DataSet();
DataTable dtReturn = dsReturn.Tables.Add();
dtReturn.Colu         


        
1条回答
  •  温柔的废话
    2021-01-29 16:04

    DataSet customerOrders = new DataSet("CustomerOrders");
    
    DataTable ordersTable = customerOrders.Tables.Add("Orders");
    
    DataColumn pkOrderID = 
        ordersTable.Columns.Add("OrderID", typeof(Int32));
    ordersTable.Columns.Add("OrderQuantity", typeof(Int32));
    ordersTable.Columns.Add("CompanyName", typeof(string));
    
    ordersTable.PrimaryKey = new DataColumn[] { pkOrderID };
    

    0 讨论(0)
提交回复
热议问题