Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我想向datatable中添加新行,而不影响现有数据_C#_Winforms - Fatal编程技术网

C# 我想向datatable中添加新行,而不影响现有数据

C# 我想向datatable中添加新行,而不影响现有数据,c#,winforms,C#,Winforms,这是将数据绑定到datatable的代码 dtPromotion = db.GetDatastrong text(drcheck["vb"].ToString()); //create the new row DataRow newRow = dtPromotion.NewRow(); //Set the columns newRow["Col1"] = "data"; newRow["Col2"] = "data"; //add the row to the data table dt

这是将数据绑定到datatable的代码

dtPromotion = db.GetDatastrong text(drcheck["vb"].ToString());

//create the new row
DataRow newRow = dtPromotion.NewRow();

//Set the columns
newRow["Col1"] = "data";
newRow["Col2"] = "data";

//add the row to the data table
dtPromotion.Rows.Add(newRow);