QUE TAL. SALUDOS ,,
TENGO UNA DUDA. QUISIERA SABER COMO LANZAR UN SP DE ORACLE DESDE ADO.NET ?
Hice una conexion por ODBC , prueba la conexion y me responde
correctamente pero en le codigo al llegar a la linea
int resp = comando.ExecuteNonQuery();
me manda un error :
Unhandled Exception: System.NullReferenceException: Object reference not set
to
an instance of an object.
at System.Data.Common.Odbc32.SQLExecDirectW(IntPtr StatementHandle,
String St
atementText, Int32 TextLength)
at Microsoft.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
behavi
or, String method)
at Microsoft.Data.Odbc.OdbcCommand.ExecuteNonQuery()
at CargaHDFoto.Class1.conexionODBC()
at CargaHDFoto.Class1.Main(String[] args)
Esto es lo que uso para la conexion
OdbcConnection cn;
string strConnection = @"dsnºCUDV2;uid=cte_unico;pwd=cte_unico;";
cn = new OdbcConnection(strConnection);
string mystring = "EXEC CTE_UNICO.SpInsBioTarjetaAzteca";
OdbcCommand comando = new OdbcCommand(mystring,cn);
comando.CommandType = CommandType.StoredProcedure;
try
{
cn.Open();
Console.WriteLine("conexion OK");
int resp = comando.ExecuteNonQuery(); <<<<< AQUI DA EL ERROR
Console.WriteLine("ok SP");
}
catch (OdbcException ex)
{
cn.Close();
string mensaje = ex.ToString();
Console.WriteLine("ERROR AL EJECUTAR SP : " + mensaje);
}
Que estara fallando ?
Pueden darme una idea por favor ?
Gracias
Leer las respuestas