i downloaded oradirect mobile component and i am using it on .NET 2003 for establishing connection between ppc application and Oracle database.I want to run an oracle stored procedure from c# and i want to set input variables and get output variables of stored procedures. I changed corelab sample codes to do this. I created one oracle connection component and two oracle command components(for two stored procedures). when i run the application first i can establish connection to stored procedure and set the input variables but when i tried to that second time it gives an exception "CoreLab.Oracle.OracleException"
for "OracleCommand.ExecuteNonQuery();"
and the same exception is given for "OracleDataReader reader = oracleCommand1.ExecuteReader();" getting the output variables of stored procedure second time.
Is this a trial limitation or is there something wrong with my codes?
my codes:
Code: Select all
oracleConnection1.Open();
OracleParameter para = new OracleParameter("i_num",OracleDbType.Number);
para.Direction = ParameterDirection.Input;
para.Value = 2;
OracleCommand.Parameters.Add(para);
OracleParameter para2 = new OracleParameter("i_var",OracleDbType.VarChar);
para2.Direction = ParameterDirection.Input;
para2.Value = "b";
OracleCommand.Parameters.Add(para2);
OracleCommand.ExecuteNonQuery();
Code: Select all
oracleConnection1.Open();
OracleParameter para = oracleCommand1.Parameters.Add("i_num" , OracleDbType.Number);
para.Direction = ParameterDirection.Output;
OracleParameter para2 = oracleCommand1.Parameters.Add("i_var" , OracleDbType.VarChar);
para2.Direction = ParameterDirection.Output;
OracleDataReader reader = oracleCommand1.ExecuteReader();
string n = oracleCommand1.Parameters["i_num"].Value.ToString();
string v = oracleCommand1.Parameters["i_var"].Value.ToString();
MessageBox.Show( n + v );
reader.Close();