Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why won't CommandBuilder make an InsertCommand?

543686Nov 7 2006 — edited Nov 8 2006
Aaargh. Here's my c# code, with names changed to protect the innocent :)

When this block is run, the dataset has already been created to exactly match the database table, and the dataset has six rows in it. I receive the error:

"Update requires a valid InsertCommand when passed DataRow collection with new rows."

I just want to add these dataset rows to my database - what am I doing wrong?

Thanks for any enlightenment,

cdj

=====================

try
{
//Do Oracle magic to Update database with dataset.tables["table"] table
//MAKE SURE THIS IS ON THE TEST TABLE!!!
//string oracleTable = "myTable";
string orSelectString = "select * from myTable";
OracleDataAdapter da_saveAdapter = new OracleDataAdapter(orSelectString, dc_UAT);
OracleCommandBuilder cb_saveCB = new OracleCommandBuilder(da_saveAdapter);

da_saveAdapter.Update(myDataSet, "tbl");


//Final statusbar message
this.ParentFormStatusBar.Text = basicText + "Rates successfully saved to database.";
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Save to database error");
this.ParentFormStatusBar.Text = basicText + "Save to database failed.";
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2006
Added on Nov 7 2006
3 comments
784 views