HI,
protected void btnUpdate_Click (object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand MyCommand;
MyConnection = new SqlConnection() ;
MyConnection.Co nnectionString =
ConfigurationMa nager.Connectio nStrings["ConnectionStri ng"].ConnectionStri ng;
MyConnection.Op en();
MyCommand = new SqlCommand("Sta ffApplyLeave", MyConnection);
MyCommand.Comma ndType = CommandType.Sto redProcedure;
MyCommand.Param eters.Add("@h_i d", Request.QuerySt ring["h_id"]);
MyCommand.Param eters.Add("@sh_ id", Request.QuerySt ring["staff_id"]);
MyCommand.Param eters.Add("@h_n ame", txtName.Text);
MyCommand.Param eters.Add("@h_f rom", txtFrom.Text);
MyCommand.Param eters.Add("@h_t ill", txtTill.Text);
MyCommand.Param eters.Add("@h_a dd", txtA1.Text + txtA2.Text);
MyCommand.Param eters.Add("@h_p ost", txtPost.Text);
MyCommand.Param eters.Add("@h_d ept", txtDept.Text);
MyCommand.Param eters.Add("@h_s taffno", txtStaff.Text);
MyCommand.Param eters.Add("@h_h p", "+6" + txtH.Text + txtP.Text);
MyCommand.Param eters.Add("@h_e mail", txtEmail.Text);
MyCommand.Param eters.Add("@h_d ay", txtDay.Text);
MyCommand.Param eters.Add("@h_d ate_apply", DateTime.Today. ToString());
MyCommand.Execu teScalar();
MyConnection.Cl ose();
MyConnection.Cl ose();
Response.Redire ct("aHolidayLea ve.aspx?staff_i d=" + Request.QuerySt ring["staff_id"]);
}
Here's the related stored procedure
ALTER PROCEDURE dbo.StaffApplyL eave
(
@h_id int,
@sh_id int,
@h_name varchar(50),
@h_from datetime,
@h_till datetime,
@h_add varchar(50),
@h_post varchar(50),
@h_dept varchar(50),
@h_staffno varchar(10),
@h_hp varchar(12),
@h_email varchar(50),
@h_day int,
@h_date_apply datetime
)
AS
insert into holiday (h_id,sh_id,h_n ame,h_from, h_till, h_add, h_post, h_dept,h_staffn o,h_hp,h_email, h_day, h_date_apply)
values(@h_id,@s h_id,@h_name,@h _from, @h_till, @h_add, @h_post, @h_dept,@h_staf fno,@h_hp,@h_em ail, @h_day,@h_date_ apply)
RETURN.
Plz help solving this. Tq
protected void btnUpdate_Click (object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand MyCommand;
MyConnection = new SqlConnection() ;
MyConnection.Co nnectionString =
ConfigurationMa nager.Connectio nStrings["ConnectionStri ng"].ConnectionStri ng;
MyConnection.Op en();
MyCommand = new SqlCommand("Sta ffApplyLeave", MyConnection);
MyCommand.Comma ndType = CommandType.Sto redProcedure;
MyCommand.Param eters.Add("@h_i d", Request.QuerySt ring["h_id"]);
MyCommand.Param eters.Add("@sh_ id", Request.QuerySt ring["staff_id"]);
MyCommand.Param eters.Add("@h_n ame", txtName.Text);
MyCommand.Param eters.Add("@h_f rom", txtFrom.Text);
MyCommand.Param eters.Add("@h_t ill", txtTill.Text);
MyCommand.Param eters.Add("@h_a dd", txtA1.Text + txtA2.Text);
MyCommand.Param eters.Add("@h_p ost", txtPost.Text);
MyCommand.Param eters.Add("@h_d ept", txtDept.Text);
MyCommand.Param eters.Add("@h_s taffno", txtStaff.Text);
MyCommand.Param eters.Add("@h_h p", "+6" + txtH.Text + txtP.Text);
MyCommand.Param eters.Add("@h_e mail", txtEmail.Text);
MyCommand.Param eters.Add("@h_d ay", txtDay.Text);
MyCommand.Param eters.Add("@h_d ate_apply", DateTime.Today. ToString());
MyCommand.Execu teScalar();
MyConnection.Cl ose();
MyConnection.Cl ose();
Response.Redire ct("aHolidayLea ve.aspx?staff_i d=" + Request.QuerySt ring["staff_id"]);
}
Here's the related stored procedure
ALTER PROCEDURE dbo.StaffApplyL eave
(
@h_id int,
@sh_id int,
@h_name varchar(50),
@h_from datetime,
@h_till datetime,
@h_add varchar(50),
@h_post varchar(50),
@h_dept varchar(50),
@h_staffno varchar(10),
@h_hp varchar(12),
@h_email varchar(50),
@h_day int,
@h_date_apply datetime
)
AS
insert into holiday (h_id,sh_id,h_n ame,h_from, h_till, h_add, h_post, h_dept,h_staffn o,h_hp,h_email, h_day, h_date_apply)
values(@h_id,@s h_id,@h_name,@h _from, @h_till, @h_add, @h_post, @h_dept,@h_staf fno,@h_hp,@h_em ail, @h_day,@h_date_ apply)
RETURN.
Plz help solving this. Tq
Comment