View Single Post
  #1 (permalink)  
Old Oct 5th, 2006, 13:44
djanim8 djanim8 is offline
Junior Member
Join Date: Dec 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
using apostrophe in sql statement

I'm having an error with my ASP page when a person puts an apostrphe into a field to be entered into a sql database.. here is a test on the sql statement:

SELECT * FROM tblRequests WHERE firstname="Test" AND lastname="Test'O" AND checktype="Bankruptcy" AND dateEntered="10/5/2006"

here is the code that puts it together:

Code: Select all
  newSQL="SELECT * FROM tblRequests WHERE firstname=" & Chr(34) & MBRequest("txtFirst") & Chr(34) & ""
  newSQL=newSQL & " AND lastname=" & Chr(34) & MBRequest("txtLast") & Chr(34) & ""
  newSQL=newSQL & " AND checktype=" & Chr(34) & Session("CheckType") & Chr(34) & ""
  newSQL=newSQL & " AND dateEntered=" & Chr(34) & FormatDateTime(now(),2) & Chr(34) & ""
The error I get is this:

Microsoft OLE DB Provider for ODBC Drivers error '80040e21'
ODBC driver does not support the requested properties.
/secur-it/background/submitorder.asp, line 125


can anyone help me out with this?
Reply With Quote