I have the following code with which I recover the value that a stored procedure returns to me
public bool EjecutarSQL(string consecutivo, string otratabla)
{
Clsconexion objConexion = new Clsconexion();
objConexion.SQL = "EXECUTE insertarDatos" + "'" + consecutivo + "'" + "," + "'" + otratabla + "'";
objConexion.NombreTabla = "tconsecutivo";
if (objConexion.LlenarDataSet(false) == true)
{
tblTablaDatos = objConexion.MiDataSet.Tables[0];
if (tblTablaDatos.Rows.Count>0)//se encontraron datos
{
respuesta = tblTablaDatos.Rows[0][0].ToString();
objConexion.CerrarConexion();
objConexion = null;
return true;
}
else
{
tblTablaDatos = null;
strerror = "No se encontraron datos, soy un error de capa dao";
objConexion.CerrarConexion();
objConexion = null;
return false;
}
}
else
{
strerror = objConexion.Error;
objConexion.CerrarConexion();
objConexion = null;
return false;
}
}
That I keep it in the variable answer , this fragment I have in a data layer as I can take that variable to the view layer To not make this query in the view if not return to the view only that result.
Pd: this code is for tests, please excuse my comments on the unprofessional names.
I appreciate all your contributions