加入提交命令!! 你没有提交!
for(int i=0;i
OracleConnection conn3 = new OracleConnection("data source=myoracle1;user Id=scott;password=123456");
conn3.Open();
OracleTransaction mytran = conn.BeginTransaction();
OracleCommand cmd3 = new OracleCommand("insert into JBGLB(" + " 员工号 , 姓名, 部门名, 月份, 日期 " + ") values(" + " " + dtbl.Rows[i]["员工号"] + ",'" + dtbl.Rows[i]["姓名"].ToString() + "','" + dtbl.Rows[i]["部门名"].ToString() + "'," + dtbl.Rows[i]["月份"] + "," + dtbl.Rows[i]["日期"] + " " + " )", conn3);
cmd3.ExecuteNonQuery();
mytran.Commit();
conn3.Close();
cmd3.Dispose();
}
代码这样很麻烦
OracleConnection conn3 = new OracleConnection("data source=myoracle1;user Id=scott;password=123456");
conn3.Open();
for(int i=0;i
OracleCommand cmd3 = new OracleCommand("insert into JBGLB(" + " 员工号 , 姓名, 部门名, 月份, 日期 " + ") values(" + " " + dtbl.Rows[i]["员工号"] + ",'" + dtbl.Rows[i]["姓名"].ToString() + "','" + dtbl.Rows[i]["部门名"].ToString() + "'," + dtbl.Rows[i]["月份"] + "," + dtbl.Rows[i]["日期"] + " " + " )", conn3);
cmd3.ExecuteNonQuery();
}
conn3.Close();