Running an Oracle Stored Procedure from C# ODBC

  • Thread starter Thread starter Danroved
  • Start date Start date
D

Danroved

Guest
private void getWorkArea()
{
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString = @"DSN=ABCD;" +
"Uid=ABCD;" +
"Pwd=XYZ;";
OdbcCommand command = new OdbcCommand("{ ? = CALL GETWORKAREA }", conn);
command.CommandType = CommandType.StoredProcedure;

OdbcParameter parameter = new OdbcParameter();
parameter.ParameterName = "p_WorkArea";
parameter.OdbcType = OdbcType.VarChar;
parameter.Size = 50;
parameter.Direction = ParameterDirection.Output;
command.Parameters.Add(parameter);

conn.Open();
OdbcDataReader reader = command.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader[0].ToString());
}
conn.Close();
}
}

Getting an error at ODBC Reader:

ERROR [HY000] [Oracle][ODBC][Ora]ORA-24334: no descriptor for this position

Continue reading...
 
Back
Top