Password is: #getResults.theNewPassword# [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => mxstu [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Stored Procedure - HELP! - Coldfusion - Advanced Techniques

Stored Procedure - HELP! - Coldfusion - Advanced Techniques

i have a stored procedure (written by someone else); i have used stored procedures only sparingly and never with CF. How can I output the result of the attached stored procedure (password) to the screen in CF? See below: CREATE PROC random_password ( len int = 8, --Length of the password to be generated password_type char(7) = 'simple' --Default is to generate a simple password with lowecase letters. --Pass anything other than 'simple' to generate a complex password. --The complex password includes numbers, special characters, upper case and lower case letters ) AS /************************************************** ***************************** ****************** To generate a simple ...

Sponsored Links
  1. #1

    Default Stored Procedure - HELP!

    i have a stored procedure (written by someone else); i have used stored
    procedures only sparingly and never with CF. How can I output the result of
    the attached stored procedure (password) to the screen in CF? See below:



    CREATE PROC random_password
    (
    len int = 8, --Length of the password to be generated
    password_type char(7) = 'simple'
    --Default is to generate a simple password with lowecase letters.
    --Pass anything other than 'simple' to generate a complex password.
    --The complex password includes numbers, special characters, upper case and
    lower case letters
    )
    AS

    /************************************************** *****************************
    ******************
    To generate a simple password with a length of 8 characters:
    EXEC random_password

    To generate a simple password with 6 characters:
    EXEC random_password 6

    To generate a complex password with 8 characters:
    EXEC random_password Password_type = 'complex'

    To generate a comples password with 6 characters:
    EXEC random_password 6, 'complex'

    ************************************************** ******************************
    *****************/
    BEGIN
    DECLARE password varchar(25) , type tinyint, bitmap char(6)
    SET password=''
    SET bitmap = 'uaeioy'
    --bitmap contains all the vowels, which are a, e, i, o, u and y. These vowels
    are used to generate slightly readable/rememberable simple passwords

    WHILE len > 0
    BEGIN
    IF password_type = 'simple' --Generating a simple password
    BEGIN
    IF (len%2) = 0 --Appending a random vowel to password

    SET password = password + SUBSTRING(bitmap,CONVERT(int,ROUND(1 + (RAND()
    * (5)),0)),1)
    ELSE --Appending a random alphabet
    SET password = password + CHAR(ROUND(97 + (RAND() * (25)),0))

    END
    ELSE --Generating a complex password
    BEGIN
    SET type = ROUND(1 + (RAND() * (3)),0)

    IF type = 1 --Appending a random lower case alphabet to password
    SET password = password + CHAR(ROUND(97 + (RAND() * (25)),0))
    ELSE IF type = 2 --Appending a random upper case alphabet to password
    SET password = password + CHAR(ROUND(65 + (RAND() * (25)),0))
    ELSE IF type = 3 --Appending a random number between 0 and 9 to password
    SET password = password + CHAR(ROUND(48 + (RAND() * (9)),0))
    ELSE IF type = 4 --Appending a random special character to password
    SET password = password + CHAR(ROUND(33 + (RAND() * (13)),0))
    END

    SET len = len - 1
    END

    SELECT password --Here's the result

    END
    GO

    Sponsored Links
    ccsimmons Guest

  2. #2

    Default Re: Stored Procedure - HELP!

    It might be easier if you add a column name/alias to the last output statement:

    SELECT password AS theNewPassword --Here's the result

    ... and then use ...




    <cfstoredproc procedure="random_password" datasource="#yourDSN#">
    <!--- use same order as parameters in database procedure ---->
    <cfprocparam dbvarname="len" value="7" cfsqltype="cf_sql_integer">
    <cfprocparam dbvarname="password_type" value="complex"
    cfsqltype="cf_sql_char">
    <cfprocresult name="getResults">
    </cfstoredproc>

    <cfoutput>Password is: #getResults.theNewPassword#</cfoutput>

    mxstu Guest

  3. #3

    Default Re: Stored Procedure - HELP!

    Works perfectly. Thanks.
    ccsimmons Guest

Similar Threads

  1. Stored Procedure
    By Aaron Bertrand - MVP in forum ASP.NET
    Replies: 13
    Last Post: July 5th, 05:43 AM
  2. Using a stored procedure
    By MarkWright in forum Coldfusion Database Access
    Replies: 13
    Last Post: April 15th, 05:53 PM
  3. Stored procedure
    By Uri in forum Microsoft SQL / MS SQL Server
    Replies: 13
    Last Post: August 19th, 03:23 PM
  4. Stored Procedure Help
    By Jack in forum Microsoft SQL / MS SQL Server
    Replies: 7
    Last Post: July 14th, 06:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •