|
-
Jul 13th, 2000, 09:12 AM
#1
Thread Starter
Addicted Member
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)
-
Jul 13th, 2000, 09:54 AM
#2
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.
-
Jul 13th, 2000, 02:05 PM
#3
Thread Starter
Addicted Member
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
-
Jul 13th, 2000, 02:37 PM
#4
Member
Put single quotes in the query around the variable.
...1 where name = '" & Listboxid & "' and account...
-
Jul 13th, 2000, 02:43 PM
#5
Thread Starter
Addicted Member
asp database
Thanks Capone, it works! i tried it earlier, but may have had them twisted. thanks.
-
Jul 13th, 2000, 05:12 PM
#6
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|