protected SqlCommand Setup(string commandName, DALOptions options = DALOptions.openConnection)
        {
            SqlCommand cmd;

            // Create Sql command object
            cmd = new SqlCommand(commandName, connection);

            // Set Type to StoreProcedure, which we will be executing.
            cmd.CommandType = CommandType.StoredProcedure;

            // Open connection to database if opted for.
            if (DALOptions.openConnection == options)
            {
                connection.Open();
            }

            return(cmd);
        }
예제 #2
0
        protected SqlCommand Setup(string commandName, DALOptions options = DALOptions.openConnection)
        {
            SqlCommand cmd;

            // Create Sql command object
            cmd = new SqlCommand(commandName, connection);

            // Set Type to StoreProcedure, which we will be executing.
            cmd.CommandType = CommandType.StoredProcedure;

            // Open connection to database if opted for.
            if (DALOptions.openConnection == options)
            {
                connection.Open();
            }

            return cmd;
        }