mySQL and special characters.

Results 1 to 2 of 2

Thread: mySQL and special characters.

  1. #1
    Join Date
    Dec 1969

    Default mySQL and special characters.

    Ok, i have been doing ASP for awhile with MS-SQL, but now im having to switch over to My-SQL. and I have ran into a problem with select statements. Whenever a special character is entered into a select statement that is trying to pull from mySQL it gives me this error:<BR><BR>ADODB.Recordset.1 error &#039;80004005&#039; <BR><BR>SQLState: 42000<BR>Native Error Code: 1064<BR>[TCX][MyODBC]You have an error in your SQL syntax near &#039;&#039; &#039; at line 1<BR><BR><BR>/tetrinetladder/x.asp line y<BR><BR>now any of the code it gives errors to on here works on my old MS-SQL host. im going to put the select statement in here for an example<BR>recordSet1.Open "SELECT * FROM team where team = &#039;•–*zn élite–^v´¯™&#039;",objConn,1<BR>it would give me that error that I listed earlier because of those characters in "•–*zn élite–^v´¯™". Any help on this would be greatly appreciated here is the website im trying to get work<BR>another note i would do this with ID&#039;s but at one point in the webpage you got to enter the teams name and username and then that is used in the select statement to get the ID. I really see no way out so i really need some help<BR>

  2. #2
    Join Date
    Dec 1969

    Default Try This...Replace(MyString,"'","''

    It&#039;s the single quote giving you the error...<BR><BR>Replace(MyWhereString,"&#039;","&# 039;&#039;")<BR><BR>You also need to enclose string within quotes...<BR><BR>Where Team = "&#039;" & MyWhereString & "&#039;"<BR><BR>KLC

Posting Permissions

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