My hairloss vs Too Few Parameters (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


yogaboy -> My hairloss vs Too Few Parameters (12/5/2004 18:35:54)

I get the following error far too much for my sanity

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.


when I run use this sql statement
mySQL = "SELECT Org.OrgName, Org.Website, Org.OrgCode, Partnerships.cpName FROM Org, Partnerships " & _
"WHERE Partnerships.cpCode='" & CPSelected & "' AND Org.cpCode=Partnerships.cpCode2 ORDER BY Org.OrgName"


but, if I use this sql statement it works (spot the difference!!!)
mySQL = "SELECT Org.OrgName, Org.Website, Org.OrgCode, Partnerships.cpName FROM Org, Partnerships " & _
"WHERE Partnerships.cpCode='" & CPSelected & "' AND Org.cpCode=Partnerships.cpCode ORDER BY Org.OrgName"


If you can't see the difference, I don't blame you - the first statement has
AND Org.cpCode=Partnerships.cpCode2
the second statement has
AND Org.cpCode=Partnerships.cpCode

The 2 columns in the database are exactly the same, I even copied the first one into the second one. Does anyone have any ideas why this is happening, as I'm pulling out so much hair I'll be bald by tomorrow afternoon![:@]




Spooky -> RE: My hairloss vs Too Few Parameters (12/5/2004 20:06:55)

Look at using an OLEDB connection as ODBC has been depreciated




yogaboy -> RE: My hairloss vs Too Few Parameters (12/6/2004 5:33:20)

I had a look at the 4GuysFromRolla article about switching over to OLEDB, but I have a quick question - I'm using an include for the connection strings, won't displaying the full path to the database be a security liablity? Should I stop using the include so it's not available to anyone?? I haven't had any success using VIRTUAL so I have to keep the include file in the same directory as the asp files.

I'm not sure if I should worry about this...?




yogaboy -> RE: My hairloss vs Too Few Parameters (12/6/2004 11:05:37)

Ok, I've changed everything on the site to OLEDB and very nice it is too![:)]

But the problem still remained, until I realized I should have written

Org.cpCode2=Partnerships.cpCode
NOT
Org.cpCode=Partnerships.cpCode2

Sorry bout that Spooky, but muchos gracias for the help anyway, my db connection is now much better thanks to my bungling and your help!! [:D]




Spooky -> RE: My hairloss vs Too Few Parameters (12/6/2004 13:41:16)

Try and name fields without special characters and numbers at the start / end of fields.

As long as the include is an asp file, there shouldnt be any security concerns.
DONT name it .inc or .txt or anything silly like that .... [8D]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.703125