sql statement problems

Results 1 to 2 of 2

Thread: sql statement problems

  1. #1
    Join Date
    Dec 1969

    Default sql statement problems

    Hi, this may be an easy question, but I could not find an answer in the faq's or searching through the site. My problem is this. I have a post functionality in the site I am building, but the users can type whatever they want. Well, the problem comes when they include the character ' (single quote) into the text box field. This badly forms the SQL statement. EX: "Insert into table1(field1, field2) Values ('jimmy's car', 'bowling')". Jimmy's car causes the fatal error. Can anyone give me some pointers here?

  2. #2
    Join Date
    Dec 1969

    Default It's in the faq somewhere

    f1 = "&#039;" & replace(request.form("f1"),"&#039;","&#039;&#039;" ) & "&#039;"<BR>f2 = "&#039;" & replace(request.form("f2"),"&#039;","&#039;&#039;" ) & "&#039;"<BR><BR>q = "Insert into table1(field1, field2) Values (" & f1 & "," & f2 & ")"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts