public class Class1 { private int _Event; private int _EmpId; private string _EmpName; private int _Salary; private string _City; private int _Atype; public int Event { get { return _Event; } set { Event = value; } } public int EmpId { get { return _EmpId; } set { _EmpId = value; } } public string EmpName { get { return _EmpName; } set { _EmpName = value; } } public int Salary { get { return _Salary; } set { _Salary = value; } } public string City { get { return _City; } set { _City = value; } } public int Atype { get { return _Atype; } set { _Atype = value; } } public void save() { String constr = ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString; SqlConnection connect = new SqlConnection(constr); SqlCommand command = new SqlCommand("spAllinone", connect); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@event", SqlDbType.TinyInt).Value = Atype; command.Parameters.Add("@EmpId", SqlDbType.Int).Value = EmpId ; command.Parameters.Add("@Emp_name", SqlDbType.NVarChar,50).Value = EmpName ; command.Parameters.Add("@Salary", SqlDbType.Int).Value = Salary ; command.Parameters.Add("@City", SqlDbType.NVarChar,50).Value = City ; connect.Open(); command.ExecuteNonQuery(); command.Connection.Close();
protected void Button1_Click(object sender, EventArgs e) { Class1 obj = new Class1(); obj.EmpId = Convert.ToInt32(txtEmpId.Text); obj.EmpName = txtEmpName.Text; obj.Salary = Convert.ToInt32(txtSalary.Text); obj.City = txtCity.Text; obj.Atype = Convert.ToInt32(txtEvent.Text); obj.save();
SqlCommand command = new SqlCommand("spAllinone", connect);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)