public static string InsertData(CRUDBLL data) { string conStr = System.Configuration.ConfigurationManager.ConnectionStrings["School"].ToString(); SqlConnection Con = new SqlConnection(conStr); SqlCommand cmd = new SqlCommand(); cmd.Connection = Con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Iinsertregistration"; cmd.Parameters.Add("@firstName", SqlDbType.VarChar).Value = data.firstName; cmd.Parameters.Add("@lastName", SqlDbType.VarChar).Value = data.lastName; cmd.Parameters.Add("@gender", SqlDbType.VarChar).Value = data.gender; cmd.Parameters.Add("@trainingType", SqlDbType.VarChar).Value = data.trainigType; try { Con.Open(); cmd.ExecuteNonQuery(); return("Record inserted successfully"); } catch (Exception ex) { throw ex; } finally { Con.Close(); Con.Dispose(); } }
public string Insert(CRUDBLL data) { return(CRUDDAL.InsertData(data)); }