| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 21066 | 2002-06-17 10:31:00 | Spot the difference... | Guest (0) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 54795 | 2002-06-17 10:31:00 | Hi All, Another SQL problem here... Why does this line of code execute perfectly: VideoCard = Connect.Execute('SELECT VideoCardName FROM [Video Card] WHERE VideoCardPerformance='&VideoCardVal&'') While this one: HardDrive = Connect.Execute('SELECT HardDriveName FROM [Hard Drive] WHERE HardDrivePerformance='&HardDriveVal&'') Tries to tell me it's expecting the end of the statement just after HardDrivePerformance=' With the error: Microsoft VBScript compilation error '800a03ee' Expected ')' /web/Custommethod1p2.asp, line 35 HardDrive = Connect.Execute('SELECT HardDriveName FROM [Hard Drive] WHERE HardDrivePerformance='&HardDriveVal&'') ------------------------------------------------------------------------------------------------^ You're probably going to have to go 'view' to see that, but it's pointing at the '&' symbol immediately before 'HardDriveVal' I can see no difference between these two lines of code (other than the tables and fields accessed...) Help! :) Erin |
Guest (0) | ||
| 54796 | 2002-06-17 12:39:00 | Third time this week perhaps? Your previous post showed the use of single quotes as the answer. A good way to check a select statement is to put in an actual value eg WHERE HardDrivePerformance=3 Once this is working then pass the value to it eg WHERE HardDrivePerformance='&HardDriveVal&' |
Guest (0) | ||
| 54797 | 2002-06-18 04:57:00 | Just a guess: if values in your tables are strings which can contain space characters, *and* these strings are substituted into SQL exepressions which are *then* sent back to be interpreted, you will foul up the syntax and get an error message. I'm pretty sure that that mechanism was what gave you the 'missing operator' in your previous posting. So you needed the quotes aropund the extracted value to make it into a single string containing a number of words. In this case, if it's a numeric value, perhaps you *don't* need the quotes around the extracted value --- it's likely to be pretty fussy about the types (integer versus string containing a character representing a numeric value). Bloody computers do as they're told; not what you want ... |
Guest (0) | ||
| 54798 | 2002-06-18 06:54:00 | Ah... of course! (We do know it's a while since I touched ASP don't we?) A vague memory stirred. Strings need to be enclosed in quotes: 'string' Numbers don't: 3 If in your database you have one field as text, and the other as number then copying code won't work as you'll be copying the quote marks. I still recommend testing the code with a fixed value. Once it works use a passed value. This helps to narrow the fault down to code or connection to the database. |
Guest (0) | ||
| 1 | |||||