you should merge your open() and save() methods.
try this:
public void openAndSave()
{
String constr = ConfigurationManager.ConnectionStrings["testing"].ConnectionString;
SqlConnection connect = new SqlConnection(constr);
SqlCommand command = new SqlCommand("spdatabaseconnect",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();
command.Dispose();
connect.Close();
}
Also here are some other things you need to check.
1. make sure your connection string is correct.
2. make sure that the stored procedure you are calling exists
If you need to have save() and open() methods separately please refer to solution #1 and make this change in your button click
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.open();
obj.save();