日期:2014-05-17 浏览次数:20828 次
OleDbDataAdapter adapt = new OleDbDataAdapter("select id,ItemGuid,StartTime from " + tableName, conn);
adapt.Fill(dt);
var cmd = new OleDbCommand("insert into " + tableName + "(ID,ItemGuid,StartTime) values(@id,@ItemGuid,@StartTime)", conn);
cmd.Parameters.Add("@Id", OleDbType.Integer, 4, "Id");
cmd.Parameters.Add("@ItemGuid", OleDbType.VarChar, 40, "itemGuid");
cmd.Parameters.Add("@StartTime", OleDbType.VarChar, 20, "StartTime");
adapt.InsertCommand = cmd;
if (dt != null)
{
try
{
adapt.Update(dt);
}
catch (Exception e)
{
return e.Message;
}
}
System.Data.DataTable dataTable1 = new System.Data.DataTable("TestTableXXXXXXXXXXXXXXXXXX");
System.Data.DataRow dr;
dataTable1.Columns.Add(new System.Data.DataC