DataSet dsClass = new DataSet();
DataTable dtClass = new DataTable("Class");
DataColumn name = new DataColumn("name",typeof(string)); //增加列名
DataColumn url = new DataColumn("url", typeof(string));
dtClass.Columns.Add(name);
dtClass.Columns.Add(url);
dtClass.Rows.Add(new object[] { "a", "b" }); //写入数据
dtClass.Rows.Add(new object[] { "c", "d" });
dsClass.Tables.Add(dtClass);
Dataset dss;
Dataset ds;
if (dss.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr1 in dss.Tables[0].Rows)
{
ds.Tables[0].ImportRow(dr1);
}
}
return ds;
dataSet dss = new DataSet();
try
{
con.Open();
da.Fill(dss, "table1");
con.Close();
dss.Tables[0].Columns.Add("mark", typeof(string)); //新增加一个字段
foreach (DataRow col in dss.Tables[0].Rows)
{
col["mark"] = getFocus(); //为新增加的值赋值
}