It must be a silly question but don't know what's wrong with my code
I'm trying to insert some data in oracle database here is my piece of code
try
{
OracleConnection con= new OracleConnection("Data Source=ANTI01T.world ;User Id=MyDB;Password=XYZ123 ;");
con.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection =con;
cmd.CommandText = query;
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
where query is
string query = @"INSERT INTO TB_RULE_HISTORY
( N_RULE_ID,
N_RULE_VERSION,
DT_START_DATE,
DT_END_DATE,
N_CURRENCY_ID,
N_VALUE1,
N_VALUE2,
N_PERCENTAGE,
N_MONTHS)
VALUES("
+ pRuleId.ToString() + " , "
+ pRuleVersion.ToString() + " , '"
+ DateTime.Now.Date.ToString("dd/MMM/yy") + "' , '"
+ pEndDate.ToString("dd/MMM/yy") + "' , "
+ pCurrencyId.ToString()+ " , "
+ pValue1.ToString()+ " , "
+ pValue2.ToString()+ " , "
+ pPercentage.ToString()+ " , "
+ pMonths.ToString() + ")";
The code is not throwing any error it got stuck don't know where
The possible check I did is that I remove the semicolon from the query by referring Link1 because executing query with ; gives ORA-00911: invalid character, but now it is not throwing any error just got stuck.
Also there is no transaction in use.
Please suggest the possible way to trace it out