CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • Microsoft OLE DB Provider for SQL Server (0x80040E14) Parameterized Query

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    65
  • Date Created
    Monday, December 6, 2010
  • Last Updated
    Monday, January 3, 2011
  • This Article Has been Viewed
    1778 times
  • Short Desc
    When you create a Variable, sometimes you might inadvertently write it out wrong.
  • Details
    When you pass your variable to the query, you must make sure that the variable contains a value, if it does not, you will receive this error.

     
    Microsoft OLE DB Provider for SQL Server (0x80040E14)
    Parameterized Query '(@P1 varchar(25))SELECT Users.mpsuid, Users.Username, Me' expects parameter @P1, which was not supplied.
    /Statistics.asp, line 8
  • Recreate Issue
    The following example, uses the variable struns, but does not use it in the Query.

    <%
    strcuns = Request.Cookie("mycookiename")
    Set sqlgetID = Server.CreateObject("ADODB.Command")
    sqlgetID.ActiveConnection=PDConn
    sqlgetID.Prepared = true
    sqlgetID.commandtext="SELECT Username FROM Users WHERE Username=?"
    sqlgetID.Parameters.Append sqlgetID.CreateParameter("@username", adVarChar, adParamInput, 25, strcun)
    set rsgetID = sqlgetID.execute
    %>
  • Resolve Issue
    To correctly write your Query, make sure that it is spelled correctly.
    Both area's must be the same, the Request and the Query.

    <%
    strcun = Request.Cookie("mycookiename")
    Set sqlgetID = Server.CreateObject("ADODB.Command")
    sqlgetID.ActiveConnection=PDConn
    sqlgetID.Prepared = true
    sqlgetID.commandtext="SELECT Username FROM Users WHERE Username=?"
    sqlgetID.Parameters.Append sqlgetID.CreateParameter("@username", adVarChar, adParamInput, 25, strcun)
    set rsgetID = sqlgetID.execute
    %>