I have the following problem: I have an application in 3 layers in the data layer I have the following code:
public string D_RegistroAprobacionRH(int vopt, string vObservacionVrh, string vUsuarioValidarh, string vObservacionArh, string vUsuarioApruebarh, string vObservacionLogistica, string vUsuarioApruebaLogist)
{
try
{
string _bol = "";
sqlconx = new SqlConnection();
sqlconx.ConnectionString = vConec.conxWebProd;
dt = new DataTable();
dAdap = new SqlDataAdapter();
cmd = new SqlCommand();
cmd.Connection = sqlconx;
cmd.CommandTimeout = 7000000;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Usp_RegitroValidacion";
cmd.Parameters.Add(new SqlParameter("@Opt", SqlDbType.Int)).Value = vopt;
cmd.Parameters.Add(new SqlParameter("@Observacionvrh", SqlDbType.VarChar,150)).Value = vObservacionVrh;
cmd.Parameters.Add(new SqlParameter("@Usuariovrh", SqlDbType.VarChar, 30)).Value = vUsuarioValidarh;
cmd.Parameters.Add(new SqlParameter("@ObservacionArh", SqlDbType.VarChar, 150)).Value = vObservacionArh;
cmd.Parameters.Add(new SqlParameter("@UsuarioArh", SqlDbType.VarChar, 30)).Value = vUsuarioApruebarh;
cmd.Parameters.Add(new SqlParameter("@ObservaLogi", SqlDbType.VarChar, 150)).Value = vObservacionLogistica;
cmd.Parameters.Add(new SqlParameter("@UsuarioAprlog", SqlDbType.VarChar, 30)).Value = vUsuarioApruebaLogist;
dt.Clear();
dt.Reset();
if (sqlconx.State == ConnectionState.Closed)
{
sqlconx.Open();
}
cmd.ExecuteNonQuery();
sqlconx.Close();
return _bol ;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
in the business layer I have the following code:
public string B_RegistraAprobacionrh(int vopt, string vObservacionVrh, string vUsuarioValidarh, string vObservacionArh, string vUsuarioApruebarh, string vObservacionLogistica, string vUsuarioApruebaLogist)
{
return vDregistraValida.D_RegistroAprobacionRH(vopt, vObservacionVrh, vUsuarioValidarh, vObservacionArh, vUsuarioApruebarh, vObservacionLogistica, vUsuarioApruebaLogist);
}
In the presentation I have the following code which is where I get an error:
protected void btnaprobarrh_Click(object sender, EventArgs e)
{
string Exec = "";
Exec= vB_ApruebaRRHH.B_RegistraAprobacionrh(2, "", "", "", Session["Usuario"].ToString(), "", "");
btnaprobarrh.Enabled = false;
btnDescargar.Enabled = false;
Response.Write("<script language=javascript>alert('Aprobación Registrada Correctamente...!');</script>");
}
shows me the following message:
Object reference not set to an instance of an object.