|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm having a problem with a query on a new table that I've just added to my database.
Here's the query: <% productID=Request.Querystring("pID") Set conn = Server.CreateObject("ADODB.Connection") conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("theDB.mdb") sql = "SELECT * FROM kbs, authors WHERE kbs.author=authors.authorID AND id = " & productID & ";" set rs = Server.CreateObject("ADODB.Recordset") set rs = conn.execute(sql) %> With this, I get a 'too few parameters' error message, but a nearly identical query gives me exactly what I want. Here's the one that works: <% productID=Request.Querystring("pID") Set conn = Server.CreateObject("ADODB.Connection") conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("theDB.mdb") sql = "SELECT * FROM kbs, media where kbs.media=media.mediaTypeID AND id = " & productID & ";" set rs = Server.CreateObject("ADODB.Recordset") set rs = conn.execute(sql) %> I've checked the relationships of all 3 tables, and they all look exactly the same, so I can't figure out why the query from kbs-media works, but kbs-authors doesn't. Is there something about table structure I don't know or am missing, or is it something else completely? ![]() |
|
#2
|
|||
|
|||
|
is the field type for kbs.author same as authors.authorID?
|
|
#3
|
|||
|
|||
|
Quote:
authors.authorID is autonumber and kbs.author is number. |
|
#4
|
|||
|
|||
|
well, since both are similar, i can't see any wrong in the field type. Are there any identical records (author = authorid) in kbs & media ?
|
|
#5
|
|||
|
|||
|
I'm using Access and the kbs table was filled out using look-up wizards on the subject, media and authors fields. The authors, media and subject tables are all identical as are their relationships to kbs, except that authors has one more field than media or subject (they have 2, authors has 3, but that shouldn't make a difference, should it??
|
|
#6
|
|||
|
|||
|
i don't think that shud matter. well, i guess i can't really help you out here.
good luck troubleshooting. |
|
#7
|
||||
|
||||
|
Use this in your first line of code
productID=Cint(Request.Querystring("pID") ) Now it should work. Before this change, it was a string and you handled it like integer. |
|
#8
|
|||
|
|||
|
I actually got it to work yesterday using this:
sql = "SELECT * FROM kbs, authors, media WHERE kbs.author=authors.authorID AND id = " & productID & " AND kbs.media=media.mediaTypeID;" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Too few parameters. Expected 1. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|