how do i query access database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a very basic database setup in Acces 2003. Iit contains an ID,
First_Name, and Last_Name. In access i have set all three as key (i
highlighted the three rows in design vew and clicked on the key button). I'm
using asp and sql to query.

When i use "select * FROM table WHERE ID = 104" this statement works fine
but when i use "select * From table Where First_Name = \"joe\"" it doest
work and gives me an error as such:

Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/marks.asp, line 81, column 61

I don't know if this issue is related to "key" or the fact that they are
text value.\


if anyone has a good idea can you please let me know.

Thanks
 
AFAIK, the Jet compiler does not recognize \ as an escape character.
Some options:
Use "" to include a double quote.
Use ' to surround a text value inside a double-quoted string.
(Beware, though, if you use this for Last Names like O'Neill)
Concatenate in chr$(34)
 
Back
Top