Problem with OracleDataAdapter,SELECT ?

  • Thread starter Thread starter Sven Horn
  • Start date Start date
S

Sven Horn

Hi all,
i try to add rows to a table using classes:
OracleCommand,OracleDataAdapter and OracleCommandBuilder.
bug ?

i make a select-command to fill the scheme of my
DataSource Object with Function FillSchema().
After this i add some rows, and i try to call Update()
and Update always brings a error: "SELECT Statement
missing"

adapter.InsertCommand is filled with correct
statement "INSERT INTO....." if i change it so a SELECT
statement, the error differs. So it is clear that Update
() trys to use adapter.InsertCommand

is this a bug ? is there a solution ?
thank you,
sven

CODE:
_________________________________________________________

DataSet dSwp = new DataSet();
OracleCommand oCommand = new OracleCommand("SELECT *
FROM "+Global.OraSchemaName+".SAP_WP ",this.oracleConnecti
on);

OracleDataAdapter oAdapter = new OracleDataAdapter();
// Create the UpdateCommand.
oAdapter.SelectCommand = oCommand;
OracleCommandBuilder oCommandBuilder = new
OracleCommandBuilder(oAdapter);
oAdapter.FillSchema(dSwp,SchemaType.Source);
dSwp.AcceptChanges();
DataRow dRow1;

....
dRow1 = dSwp.Tables[0].NewRow();

....
dRow1["ENDDATE"] = splitline[6];
dRow1["ENDTIME"] = splitline[7];
dRow1["TEXT"] = splitline[8];

dSwp.Tables[0].Rows.Add(dRow1);
//oAdapter.InsertCommand = CommandBuilder.GetInsertCommand
();

oAdapter.Update(dSwp.Tables[0]);
 
Back
Top