把List<string>转为DataTable
//把List<string>转为DataTable
List<string> myList = new List<string>();
DataTable dt2 = new DataTable();
dt2.Columns.Add(new DataColumn("sqlString", typeof(string))); //给表dt2添加字段
DataRow dr;
foreach (var i in myList)
{
dr = dt2.NewRow(); //字段对象
dr["sqlString"] = i; //赋值
dt2.Rows.Add(dr); //添加给表
}
社会中的尘埃,随风而动而已