Exemple #1
0
        private static SqlCommand BuildIntCommand(SqlConnection connection, string storedProcName, IDataParameter[] parameters)
        {
            SqlCommand command = DbHelperSQLP.BuildQueryCommand(connection, storedProcName, parameters);

            command.Parameters.Add(new SqlParameter("ReturnValue", SqlDbType.Int, 4, ParameterDirection.ReturnValue, false, 0, 0, string.Empty, DataRowVersion.Default, null));
            return(command);
        }
Exemple #2
0
        public SqlDataReader RunProcedure(string storedProcName, IDataParameter[] parameters)
        {
            SqlDataReader result;

            using (SqlConnection connection = new SqlConnection(this.connectionString))
            {
                connection.Open();
                SqlCommand command = DbHelperSQLP.BuildQueryCommand(connection, storedProcName, parameters);
                command.CommandType = CommandType.StoredProcedure;
                SqlDataReader returnReader = command.ExecuteReader(CommandBehavior.CloseConnection);
                result = returnReader;
            }
            return(result);
        }
Exemple #3
0
        public DataSet RunProcedure(string storedProcName, IDataParameter[] parameters, string tableName)
        {
            DataSet result;

            using (SqlConnection connection = new SqlConnection(this.connectionString))
            {
                DataSet dataSet = new DataSet();
                connection.Open();
                new SqlDataAdapter
                {
                    SelectCommand = DbHelperSQLP.BuildQueryCommand(connection, storedProcName, parameters)
                }.Fill(dataSet, tableName);
                connection.Close();
                result = dataSet;
            }
            return(result);
        }