Multiple attempts to insert a row into a table in a dataset by using the Import method
No error, but check data set discovery data is not inserted, and has a long burst of inspiration
If the table in the dataset is empty (the table in the dataset is empty before the table is inserted)
Add a row before inserting successfully
I have a problem with practice.
Release code
DataRow Rowadd = ds. tables[0]. NewRow (); rowadd["d_inventory_id"] = row["d_inventory_id"]. ToString (); rowadd["D_name"] = row["D_name"]; rowadd["D_model"] = row["D_model"]; rowadd["D_vin"] =""; rowadd["D_unit"] = row["D_unit"]; rowadd["D_number"] ="1"; rowadd["D_color"] =colour; rowadd["D_bomconfig"] =config; rowadd["D_ddon"] = row["D_CN"];//No judgment at first, no error, but the data set is empty.//later added the judgment first insert call add otherwise call ImportRow for(inti =1; I <=int. Parse (RESTN); i++) { if(i = =1) {ds. tables[0]. Rows.Add (Rowadd); } Else{ds. tables[0]. ImportRow (Rowadd); } }
DataSet DataTable Import method cannot be inserted