www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > ASP

    ASP Discussion and technical support for using and deploying Active Server Pages.

     
     
    Thread Tools Rate Thread Display Modes
    Prev Previous Post   Next Post Next
      #1  
    Old 08-10-2007, 10:16 AM
    AppalachiaAl AppalachiaAl is offline
    Registered User
     
    Join Date: Apr 2006
    Location: Barlow, Ohio
    Posts: 7
    Classic ASP - help using parameters

    I have some old code that I inherited and I need to update it to use parameters to prevent SQL injection attacks. I've tried the below but I get error that I "Must declare the variable '@fName'." Does some one see what's wrong. Also, if someone has a an example to update and insert using parameters I would appreciate it. I've tried googoling but you get about a million hits and everything is for .Net
    Below is the code I have.

    set objCmd = Server.CreateObject("ADODB.Command")
    With objCmd
    .ActiveConnection = conn
    .CommandText = "select userID from tblUser where fname = @fName and lname = @lName and company = @Company and email = @eMail"
    .Parameters.Append .CreateParameter("@fName", adVarChar, adParamInput, 50, strfname)
    .Parameters.Append .CreateParameter("@lName", adVarChar , adParamInput, 50, strlname)
    .Parameters.Append .CreateParameter("@Company", adVarChar , adParamInput, 75, strcompany)
    .Parameters.Append .CreateParameter("@eMail", adVarChar , adParamInput, 100, stremail)
    Set rs2 = .Execute
    End With

    THanks
    Allen
    __________________
    In God we trust, all others pay cash

    Last edited by AppalachiaAl; 08-10-2007 at 10:23 AM.
    Reply With Quote
     

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:27 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.