我尝试进行插入,从c#中的oracledatareader对象读取,我正在读取大约50行并将其插入db,持续300次,直到150-200左右就可以了。迭代,但在那之后datareader.Read()停止读取,所以无法插入,那会有什么问题呢?
谢谢
OracleConnection con = new OracleConnection(connectionString);
while(true)
{
if (con.State == System.Data.ConnectionState.Closed)
{
con.Open();
}
OracleCommand transaction = new OracleCommand(@"select * from foos where date=:date", con);
DateTime d=DateTime.now;
transaction .Parameters.Add("date", d);
transaction.CommandType = System.Data.CommandType.Text;
OracleDataReader r =Tansaction.ExecuteReader(CommandBehavior.SequentialAccess);
while (r.Read())
{
fooitem = new foo();
item.Date = Convert.ToDateTime(dr["creationdate"]);
item.SectionId = dr["sectionId"].ToString();
InsertSalesItem(item);
}
d=d.AddDays(-1);
}