.NET
Microsoft Technologies based on the .NET software framework.
3,917 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm using Oracle.ManagedDataAccess.Client to make queries to oracle database, but having an issue in update query.
I tried different workarounds like CAST with NVARCHAR2 and wrote DBInterceptor by following this POST.
But none of them are working. I also have an Insert Statement with the same parameters and it works perfectly. I'm struggling for the last 2 days, any help will be highly appreciatable.
Update Statement:
string query = @"update APP_DB_TABLE set ""Tracking_NM""=:reportName, ""Start_DT""=:startDate, ""End_DT""=:endDate, ""Tracking_Developer_NM""=:devName, ""Tracking_Description_TXT""=:description," +
@" ""RunBook_TXT""=:runbook, ""Parameter_TXT""=:params, ""Distribution_TXT""=:distributionList, ""OUTPUT_FILE_FILE_TXT""=:fileName," +
@"""CategoryId""=:catId, ""TrackingStatusId""=:trackingStatusId, ""TrackingTypeId""=:trackingTypeId where ""Db_Table_ID""=:id";
using (var conn = new OracleConnection(connection))
{
conn.Open();
var cmd = new OracleCommand(query, conn);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Parameters.Add("id", data.Id);
cmd.Parameters.Add("reportName", data.ReportName);
cmd.Parameters.Add("startDate", data.StartDate);
cmd.Parameters.Add("endDate", data.EndDate);
cmd.Parameters.Add("devName", data.DeveloperName);
cmd.Parameters.Add("description", data.ReportDescription);
cmd.Parameters.Add("runbook", data.RunbookName);
cmd.Parameters.Add("params", data.ReportParameter);
cmd.Parameters.Add("distributionList", data.DistributionList);
cmd.Parameters.Add("fileName", data.OutputFileName);
cmd.Parameters.Add("catId", data.CategoryId);
cmd.Parameters.Add("trackingStatusId", data.TrackingStatusId);
cmd.Parameters.Add("trackingTypeId", data.TrackingTypeId);
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
}
}
Thanks