Professional Web Applications Themes

Passing Parameters in Access Queries - ASP Database

I'm sure this has been asked before, but I'm new to ASP and haven't been able to find the answer anywhere: I've got a query in Access that requires a parameter, the person's name. I'm trying to run that query from my ASP code using either a Command object or Connection object, but can't figure out how to pass the parameter value. Here's what I've tried: objCmd.ActiveConnection = strConnStr objCmd.CommandText = strQuery objCmd.CommandType = adCmdStoredProc objCmd.Parameters.Append objCmd.CreateParameter("[Enter: Last, First]", adVarChar, adParamInput, 255, strResp) Set objRS = objCmd.Execute If possible, I would like to do this by calling the query in ...

  1. #1

    Default Passing Parameters in Access Queries

    I'm sure this has been asked before, but I'm new to ASP
    and haven't been able to find the answer anywhere:

    I've got a query in Access that requires a parameter, the
    person's name. I'm trying to run that query from my ASP
    code using either a Command object or Connection object,
    but can't figure out how to pass the parameter value.

    Here's what I've tried:

    objCmd.ActiveConnection = strConnStr
    objCmd.CommandText = strQuery
    objCmd.CommandType = adCmdStoredProc

    objCmd.Parameters.Append objCmd.CreateParameter("[Enter:
    Last, First]", adVarChar, adParamInput, 255, strResp)

    Set objRS = objCmd.Execute


    If possible, I would like to do this by calling the query
    in Access, and not have to create the SQL statement in ASP.

    Can someone tell me if this is possible?

    Thanks in advance,
    Gordon
    Gordon Guest

  2. #2

    Default Re: Passing Parameters in Access Queries

    Gordon wrote: 

    That should have worked, given that strQuery contained the name of the saved
    query. What happened when you tried it?
     

    Do a Google for posts by me containing the words "saved parameter query"


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Guest

  3. #3

    Default Re: Passing Parameters in Access Queries


    "Bob Barrows [MVP]" <SPAMcom> wrote in message
    news:phx.gbl... 
    >
    > Do a Google for posts by me containing the words "saved parameter query"[/ref]


    The first 98 results in that search return posts saying:

    "Do a Google for posts by me containing the words "saved parameter query""

    I'm making this up. I didn't really search. :P

    Ray at work


    Ray Guest

  4. #4

    Default Re: Passing Parameters in Access Queries

    Ray Costanzo [MVP] wrote: 
    >>
    >> Do a Google for posts by me containing the words "saved parameter
    >> query"[/ref]
    >
    >
    > The first 98 results in that search return posts saying:
    >
    > "Do a Google for posts by me containing the words "saved parameter
    > query""
    >
    > I'm making this up. I didn't really search. :P
    >
    > Ray at work[/ref]

    I had started to think about this. Perhaps I should add " ... before 7 Jul
    2004 ... "

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Guest

Similar Threads

  1. Passing Parameters To CFC
    By Natty2112 in forum Coldfusion Flash Integration
    Replies: 1
    Last Post: December 31st, 11:10 AM
  2. passing parameters
    By Lewis Wang [MSFT] in forum ASP.NET Building Controls
    Replies: 3
    Last Post: June 24th, 12:16 AM
  3. Passing Query Parameters in Sub-Queries
    By Bob Barrows [MVP] in forum ASP Database
    Replies: 1
    Last Post: May 27th, 09:56 PM
  4. Passing Parameters into NEW()
    By Bubba Thomas in forum ASP.NET Web Services
    Replies: 9
    Last Post: January 15th, 10:33 PM
  5. Help Passing Parameters
    By Bullschmidt in forum ASP
    Replies: 0
    Last Post: August 22nd, 01:12 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139