Howdy,
Can someone tell me how im suppsoed to do this? Im new to this and im sure
im doing something stupid. Im trying to update a table. I have the sql
there, and i was able to update the table if i hardcoded everything, but i
would really like to use parameters. Here is my code.
thank you,
rodrigo
ro*************@dfps.state.tx.us
----------------
public void UpdateReportDetails(ReportDetailInfo reportDetailInfo)
{
OracleConnection dbConnection = null;
OracleCommand dbCommand = null;
OracleDataReader dbReader = null;
string UpdateString = "UPDATE REPORTS SET "
+ "TXT_RPT_FULL_NAME = @fullName "
+ "WHERE NM_RPT_SQR_NAME = 'ccf04o' "
+ " AND NM_RPT_SQR_VER = '00' " ;
dbConnection = new OracleConnection(connectionString);
dbCommand = new OracleCommand(UpdateString, dbConnection);
dbCommand.Parameters.Add(new OracleParameter("@fullName",
OracleType.VarChar,32));
dbCommand.Parameters["@fullName"].Value = reportDetailInfo.fullName;
try
{
dbConnection.Open();
dbCommand.Transaction = dbConnection.BeginTransaction();
OracleString rowid;
int rows = dbCommand.ExecuteOracleNonQuery(out rowid);
if (rows<=0)
{
throw new ApplicationException("Update for Template failed.");
}
dbCommand.Transaction.Commit();
dbCommand.Connection.Close();
dbConnection.Close();
}
catch (OracleException ex)
{
GetTemplateException te = new
GetTemplateException("ARC_DOCS_ERR_METADATA_ACCESS OR_DB_CONNECT", "A
metadata accessor could not establish a connection to the database.",
"UpdateFormTemplate", ex);
if (dbCommand != null)
dbCommand.Transaction.Rollback();
throw te;
}
catch (Exception ex)
{
if (dbCommand != null)
dbCommand.Transaction.Rollback();
throw ex;
}
finally
{
if (dbReader != null)
dbReader.Close();
if (dbConnection != null)
dbConnection.Close();
}
}