Money Earner

September 20, 2008

Coldfusion (CFM) - Updating A Category to Database using Stored Procedure + session

Filed under: Code

<cfif IsDefined(’Session.PERSONID’)>
<cfif IsDefined(’FORM.Submit’)>
    <cfquery name="qCateg" datasource="webfillers">
                
            EXEC sp_update_category
            @CATEGORY = ‘#FORM.category#’,
            @DESCRIPTIONS = ‘#FORM.descriptions#’,
            @PRODUCTCATEGID = #FORM.productcategID#
        
    </cfquery>
    <cfoutput>
        <ul>
          <li><strong>#FORM.Category#, has been successfully updated….</strong></li>
      </ul>
    </cfoutput>
</cfif>

<h2>Update Employee</h2>
<cfquery name="qCateg" datasource="webfillers">
EXEC sp_get_productcategID @PRODUCTCATEGID = #URL.productcategID#
</cfquery>
<form method="post">
    <cfoutput>
    <table width="308" border="1">
            <input type="hidden" name="productcategID" value="#qCateg.PRODUCTCATEGID#"/>
          <tr>
            <td width="128"><div align="right">Category ID : </div></td>
            <td width="164"><input type="text" name="productcategID" value = "#qCateg.PRODUCTCATEGID#" disabled/></td>
          </tr>
        <tr>
            <td width="128"><div align="right">Category : </div></td>
            <td width="164"><input type="text" name="category" value = "#qCateg.CATEGORY#"></td>
          </tr>
          <tr>
            <td><div align="right">DESCRIPTION : </div></td>
            <td><input type="text" name="descriptions" value = "#qCateg.DESCRIPTIONS#"/></td>
          </tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit"/></td>
          </tr>
    </table>
    </cfoutput>
    <a href="searchcategory.cfm">Search Category</a>
</form>
<cfelse>
<cflocation url = "login.cfm" addtoken="no">
</cfif>






















Get free blog up and running in minutes with Blogsome
Theme designed by Helga Cleve