关键代码
OracleDataAdapter da=new OracleDataAdapter();
string sql_select = string.Format("select id,dt_date,dt_time,dt_hours from {0}", biao);
string sql_insert = string.Format("insert into {0} (id,dt_date,dt_time,dt_hours) values(:id,:dt_date,:dt_time,:dt_hours)", biao);
da.SelectCommand = new OracleCommand(sql_select, oraCon);
da.InsertCommand = new OracleCommand(sql_insert, oraCon);
da.InsertCommand.Parameters.Add(":id",OracleType.VarChar,32,"id");
da.InsertCommand.Parameters.Add(":dt_date",OracleType.Number,8,"dt_date");
da.InsertCommand.Parameters.Add(":dt_time",OracleType.Number,5,"dt_time");
da.InsertCommand.Parameters.Add(":dt_hours",OracleType.Number,5,"dt_hours");
da.InsertCommand.UpdatedRowSource = System.Data.UpdateRowSource.None;
da.UpdateBatchSize=0;
DataSet ds=new DataSet();
da.Fill(ds);
int dt_hours = -3;
#region
for (int j = 0; j < 75/3;j++ )
{
dt_hours = dt_hours + 3;
for (int i = 0; i < 25600; i++)
{
Guid guid = System.Guid.NewGuid();
Object[] row = { guid, sjint, 8, dt_hours };
ds.Tables[0].Rows.Add(row);
if (i % 400 == 0)
{
da.Update(ds.Tables[0]);
ds.AcceptChanges();
ds.Tables[0].Clear();
}
}
da.Update(ds.Tables[0]);
ds.AcceptChanges();
ds.Tables[0].Clear();
dt_hours = -3;
}
for (int j = 0; j < 75 / 3; j++)
{
dt_hours = dt_hours + 3;
for (int i = 0; i < 25600; i++)
{
Guid guid = System.Guid.NewGuid();
Object[] row = { guid, sjint,20, dt_hours };
ds.Tables[0].Rows.Add(row);
if (i % 400 == 0)
{
da.Update(ds.Tables[0]);
ds.AcceptChanges();
ds.Tables[0].Clear();
}
}
da.Update(ds.Tables[0]);
ds.AcceptChanges();
ds.Tables[0].Clear();
dt_hours = -3;
}
#endregion
da.Dispose();
ds.Dispose();
oraCon.Close();
this.button2.Enabled = true;