猿问

oracle批量数据导入问题 急急急急急急!!!!求解

提示 数据导入成功 但是查库里无数据 求解 备注:dt 为将要导入的数据 ,tablename 将要导入的表名void CZDataSource(DataTable dt,string tablename)         {             var sql = string.Format("select * from {0} ", tablename);                using(OracleConnection con=new OracleConnection(DBHelp.dbConnectionString))             {                 con.Open();                 OracleTransaction tran = con.BeginTransaction();                 OracleCommand cmd = new OracleCommand(sql, con);                 OracleDataAdapter adapter = new OracleDataAdapter(cmd);                             cmd.Transaction = tran;                 try                 {                     DataTable dss = new DataTable();                     adapter.Fill(dss);                                        dss.Merge(dt);    // 数据合并                                 adapter.UpdateBatchSize = 600;                     OracleCommandBuilder cb = new OracleCommandBuilder(adapter);                                       DataTable dssfb = dss.GetChanges();                     if (dssfb != null)                     {                         adapter.Update(dssfb); // 这里更新表的副本但是提示为null                     }                     else                     {                         adapter.Update(dss);                     }                     dss.AcceptChanges();                     tran.Commit();                    My.ClientScript.Alert(this, "同步数据成功!");                 }                 catch(Exception ex)                 {                     tran.Rollback();                     My.ClientScript.Alert(this, "同步数据失败!"+ex.Message.ToString());                     con.Close();                 }             }         }
回首忆惘然
浏览 404回答 1
1回答

青春有我

合并dt好像是不会标记行的。当添加行的时候会对应有个修改状态。直接合并没有。
随时随地看视频慕课网APP
我要回答