I'm filling a Data
Grid
in C# (WinForms) via a System.Data.DataTable
. DataTable
is
filled from a DB
table
via ODP
.
I have a data
navigator
in Data
Grid
for updating, deleting and inserting rows.
I want to use DataTable
to
commit all changes made in Data
Grid
to the database.
I have to use OracleDataAdapter
but
I couldn't figure out how to achieve this.
What kind of a CommandText
should
I use to achieve all three commands (update
, delete
,insert
)?
The code below didn't work (maybe because CommandText
I
inserted is not appropriate)
public void ExecuteNonQuery(string commandText, OracleCommand oracleCommand, CommandType commandType, DataTable dataTable)
{
oracleCommand.CommandText = commandText;
oracleCommand.CommandType = commandType;
try
{
oracleCommand.Connection = m_Connection;
OracleDataAdapter oracleDataAdapter = new OracleDataAdapter(oracleCommand);
oracleDataAdapter.Update(dataTable);
}
catch (Exception)
{
LoggerTrace.Instance.Write(TraceEventType.Error, LoggerTrace.LoggerTraceSource.DatabaseManagerError, "Query could not be executed!");
throw;
}
}