How to update oracle database

How to update oracle database

Postby hrva » Fri 29 Jul 2005 12:44

How can I update some new rows in oracle database?

I get folowing error when I want do this?

-->
private void btUpdate_Click(object sender, System.EventArgs e)
{

OracleDataAdapter ProbaAdapter = new OracleDataAdapter("Select * from kaf_artikli",OracleConnection);

ProbaAdapter.UpdateCommand = new OracleCommand("Update kaf_artikli",OracleConnection);

ProbaAdapter.Fill(dataSet);
DataTable ProbaTable = dataSet.Tables[0];

DataRow ProbaRow = ProbaTable.NewRow();

ProbaRow["SIF_ART"]="2000";
ProbaRow["NAZ_ART"]="Kava";
ProbaRow["JMJ"]="kom";
ProbaRow["SIF_GRP"]="2";
ProbaRow["SIF_TAR"]="2";
ProbaRow["SIF_TAR_PP"]="2";
ProbaRow["BARCODE"]="9876543211234";
ProbaRow["VRSTA_ART"]="12";
ProbaRow["KP_GRUPA"]="12";
ProbaRow["POPUST_IND"]="5";
ProbaRow["DODATAK_IND"]="5";
ProbaRow["BROJ_AZURIRANJA"]="2";

ProbaTable.Rows.Add(ProbaRow);

ProbaAdapter.Update(dataSet);

}

On the last line of code I get this error:

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.Common.dll

Additional information: Insert


Can anyone help me?

Thx!
hrva
 

Postby Oleg » Wed 03 Aug 2005 09:19

Command:
ProbaAdapter.UpdateCommand = ...
doesn't affect on Insert operation execution;
Insert operation is determined in command ProbaAdapter.InsertCommand:
Code: Select all
ProbaAdapter.InsertCommand = new OracleCommand("Insert into kaf_artikli
(...) values (...)",OracleConnection);
Oleg
Devart Team
 
Posts: 264
Joined: Thu 28 Oct 2004 13:56


Return to dotConnect for Oracle