Home > .Net Framework > Csharp > OracleDataAdapter with the update method, dataset have multiple tables, why just update to a final?

Awaiting Answer

OracleDataAdapter with the update method, dataset have multiple tables, why just update to a final? - 用OracleDataAdapter的update方法时,dataset中有多个表,为什么只更新了最后一个?

Using OracleDataAdapter update method, dataset has multiple tables, why only update the last?
Author:dynamics-ax_hths - 05-20 13:57 Reply

Answer for OracleDataAdapter with the update method, dataset have multiple tables, why just update to a final?

Because you write the code in question
Well said! Have time to help have a look.
String ls_sql, ls_sql1, ls_sql2, ls_mdid;
  DataSet DS = new DataSet ();
  DataTable DT = new DataTable ();
  DataTable dt_lszd = new DataTable (" dt_lszd");
  DataTable dt_lsxd = new DataTable (" dt_lsxd");
  OracleDataAdapter oda;
  try

  ls_sql = " select max (mdid) mdid from thisgs";
  OracleCommand OCM = new OracleCommand (ls_sql, fpc.lsmdconn);
  ls_mdid = ocm.ExecuteScalar (.ToString ());
  ds.Tables.Add (dt_lszd);
  ds.Tables.Add (dt_lsxd);
  ls_sql1 = " delete from lslszd_tmp where mdid = " + ls_mdid;
  ls_sql2 = " select * from lslszd_tmp where mdid = " + ls_mdid;
  web.update_insert_del_lszb (ls_sql1);
  ODA = new OracleDataAdapter (ls_sql2, lszbconn);
  oda.Fill (dt_lszd);
  ls_sql1 = " delete from lslsxd_tmp where mdid = " + ls_mdid;
  ls_sql2 = " select * from lslsxd_tmp where mdid = " + ls_mdid;
  web.update_insert_del_lszb (ls_sql1);
  ODA = new OracleDataAdapter (ls_sql2, lszbconn);
  oda.Fill (DS, " dt_lsxd");
  //////////////////////////
  ls_sql = " select * from lszd where mdid = " + ls_mdid;
  + " and useday between; to_date ('" dateTimePicker1.Value.ToString (" yyyy-MM-dd" " 00:00:00','yyyy-mm-dd) hh24:mi:ss') "
  + " and; to_date ('" dateTimePicker2.Value.ToString (" yyyy-MM-dd" " 23:59:59','yyyy-mm-dd) hh24:mi:ss') "
  " union "
  + " select; * from lslszd where mdid = " ls_mdid
  + " and useday between; to_date ('" dateTimePicker1.Value.ToString (" yyyy-MM-dd" " 00:00:00','yyyy-mm-dd) hh24:mi:ss') "
  + " and; to_date ('" dateTimePicker2.Value.ToString (" yyyy-MM-dd" " 23:59:59','yyyy-mm-dd) hh24:mi:ss') ";
  DT = fpc.select (ls_sql).Tables[0];
  foreach (DataRow drTemp in dt.Rows)

(  drTemp.SetAdded);
 }
  dt_lszd.Merge (DT;  );
  ls_sql = " select b.* from lszd a, lsxd b where a.zdid =b.zdid and a.mdid = b.mdid and a.mdid = " + ls_mdid;
  + " and a.useday between; to_date ('" dateTimePicker1.Value.ToString (" yyyy-MM-dd" " 00:00:00','yyyy-mm-dd) hh24:mi:ss') "
  + " and; to_date ('" dateTimePicker2.Value.ToString (" yyyy-MM-dd" " 23:59:59','yyyy-mm-dd) hh24:mi:ss') "
  " union "
  + " select b.*; from lslszd a, lslsxd b where a.zdid =b.zdid and a.mdid = b.mdid and a.mdid = " + ls_mdid;
  + " and a.useday between; to_date ('" dateTimePicker1.Value.ToString (" yyyy-MM-dd" " 00:00:00','yyyy-mm-dd) hh24:mi:ss') "
  + " and; to_date ('" dateTimePicker2.Value.ToString (" yyyy-MM-dd" " 23:59:59','yyyy-mm-dd) hh24:mi:ss') ";
  DT = fpc.select (ls_sql).Tables[0];
  foreach (DataRow drTemp in dt.Rows)

(  drTemp.SetAdded);
 }
  dt_lsxd.Merge (DT);
  OracleCommandBuilder OCB = new OracleCommandBuilder (ODA);
  int II = 0;
  II + = oda.Update (DS, " dt_lsxd");
  II + = oda.Update (DS, " dt_lszd");
  MessageBox.Show (ii.ToString ("), " prompt;);
 }
  catch (Exception E)

  MessageBox.Show (" " + E.Message, " error; " prompt;);
 }
Ds.Tables.Add (dt_lszd);
  ds.Tables.Add (dt_lsxd);
Also can update dt_lsxd.
Consult.
  beginners.
The Update method is directed to multiple tables?
You see the update method to solve the object is the table is updated the list, hope you can post code, in order to give you answers!
Multiple table, stick out, here are two tables, the actual 8 table. Do not know how to word update which table. Can update the final table.
Dt_lszd.Merge (DT);
This time, DT data?
I think you need to start from the basic code to write, to write the most basic CommandText instead of CommandBuilder, you know, CommandBuilder won't help you create all table changes to the script, only in the Select statement of the table to create, and you create the script for themselves are not output to look what, after watching nature understand why.
Please search how to customize the SqlCommand instead of the SqlCommandBuilder to fool to create, or you can never solve a follow-up question.
Dt_lszd.Merge (DT);
This time, DT data? 
 
A data
In oda.Update (DS, " dt_lsxd" DS) when each one has data.
The 8 floor, if CommandText don't have to write a lot of words, I just don't want to write so many INSERT, so I want to use.
In the code 2
Foreach (DataRow drTemp in dt.Rows)
{
(  drTemp.SetAdded);
}
The front (dt.AcceptChanges); have a look.
References 10 buildings:
In the code 2
Foreach (DataRow drTemp in dt.Rows)
{
(drTemp.SetAdded);
}
The front (dt.AcceptChanges); have a look.
10 building, first thank you help yesterday,
Add (dt.AcceptChanges);
Not easy to use.
II = oda.Update (DS, " dt_lsxd");
II = oda.Update (DS, " dt_lszd");
In the implementation of article second, still feel dt_lsxd the table to update the database stored dt_lszd corresponding table,
The fault of the newspaper: " DataTable error " dt_lszd" SourceColumn is missing in the " XDID" DataColumn" XDID"
XDID in dt_lsxd, in dt_lszd.
Cited 12 floor:
10 building, first thank you help yesterday,
Add (dt.AcceptChanges);
Not easy to use.
II = oda.Update (DS, " dt_lsxd");
II = oda.Update (DS, " dt_lszd");
In the implementation of article second, still feel dt_lsxd the table to update the database stored dt_lszd corresponding table,
The fault of the newspaper: " DataTable error " dt_lszd" SourceColu is missing in the......
OracleCommandBuilder OCB = new OracleCommandBuilder (ODA);
  int II = 0;
  II + = oda.Update (DS, " dt_lsxd");
  II + = oda.Update (DS, " dt_lszd");
Change into
  int II = 0;
  OracleCommandBuilder ocb1 = new OracleCommandBuilder (ODA);
  II + = oda1.Update (DS, " dt_lsxd");
  OracleCommandBuilder ocb2 = new OracleCommandBuilder (ODA);
  II + = oda2.Update (DS, " dt_lszd");
Feelings may be the problem of OCB
The 11 floor Dragon Tiger
I am here to understand and not very deep, first thought or LZ problem.So don't think better of.
You think I think I know, but the feeling of LZ also is not related to several DB operation, so the creation of multiple OracleDataAdapter should be more suitable for LZ.
Cited 15 floor:
The 11 floor Dragon Tiger
I am here to understand and not very deep, first thought or LZ problem.So don't think better of.
You think I think I know, but the feeling of LZ also is not related to several DB operation, so the creation of multiple OracleDataAdapter should be more suitable for LZ.
A plurality of OCB does not work, it seems only to use multiple ODA. Thank you!

Reply OracleDataAdapter with the update method, dataset have multiple tables, why just update to a final?

Answer :
 
Reference(starts with http://):