Results 1 to 6 of 6

Thread: ASP Database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153

    Question

    On my request form is a listbox that is filled with names from a database. The recordset that I want to retrieve is in the corresponding query.asp file. When i submit the request i can an error "too few parameters. Expected 1". Here is the code that generates this error. The last line (set rstemp)is the cause of the error. Any help is appreciated.

    Dim Listboxid
    Listboxid = Request.Form("MyListBox")
    ' ASP program that displays a database in table form
    myDSN="DSN=db1"
    mySQL="select name, account, qtr1 from act_1 where name = " & Listboxid & " and account = 'ret_prem_g' and qtr1 > 0"
    showblank=" "
    shownull="-null-"

    set conntemp=server.createobject("adodb.connection")
    conntemp.open myDSN
    set rstemp=conntemp.execute(mySQL)

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Lightbulb

    Usually, when you get this kind of error, it means that you either misspelled the field name in your SQL statement or the field name your used is not in the table. Check your SQL statement again to verify that the field names are spelled correctly.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153

    ASP/Database

    Actually, the problem is in the SQL statement where I reference the name selected in the listbox on the request form. Not sure how to reference this object. I need the correct syntax for referencing the listbox (MyListBox) on the request form. Thanks

  4. #4
    Member
    Join Date
    Jun 2000
    Posts
    45
    Put single quotes in the query around the variable.
    ...1 where name = '" & Listboxid & "' and account...

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    153

    asp database

    Thanks Capone, it works! i tried it earlier, but may have had them twisted. thanks.

  6. #6
    Member
    Join Date
    Jun 2000
    Posts
    45
    np

Posting Permissions

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



Click Here to Expand Forum to Full Width