Esempio n. 1
0
 public static int executeProcedure(string StoreProcName, SqlParameter[] param)
 {
     using (SqlConnection con = DBConnectionSQL.getConnection())
     {
         using (SqlCommand cmd = con.CreateCommand())
         {
             cmd.CommandText = StoreProcName;
             cmd.CommandType = CommandType.StoredProcedure;
             if (param != null)
             {
                 cmd.Parameters.AddRange(param);
             }
             return(cmd.ExecuteNonQuery());
         }
     }
 }
Esempio n. 2
0
        public static DataSet gettable(string StoreProcName, SqlParameter[] param)
        {
            DataSet ds = new DataSet();

            using (SqlConnection con = DBConnectionSQL.getConnection())
            {
                using (SqlCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = StoreProcName;
                    cmd.CommandType = CommandType.StoredProcedure;
                    if (param != null)
                    {
                        cmd.Parameters.AddRange(param);
                    }
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        da.Fill(ds);
                }
                return(ds);
            }
        }