Whats wrong with this statement?....

Results 1 to 2 of 2

Thread: Whats wrong with this statement?....

  1. #1
    Garth Guest

    Default Whats wrong with this statement?....

    Hi,<BR><BR>I want to send user info to an access db, however, if the user enters a &#039 (inverted comma) in any one of the fields I it returns an error. I&#039ve tried extracting the &#039 before sending it to the db using the following code:<BR><BR>Form_comment = Trim(Replace(Request.Form("comment"),"&#039",""))< BR><BR>but I still get the same error???<BR><BR>I use the code below to insert the info into the db:<BR><BR>SQLstmt = "INSERT INTO userinfo (comment)"<BR>SQLstmt = SQLstmt & " VALUES (&#039" & request.form("comment") & "&#039)"<BR>conn.execute(SQLstmt)<BR><BR>This code works fine as long as the user does&#039nt use the &#039 character.<BR><BR>Thanks in advance for any help.<BR><BR>Garth<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Whats wrong with this statement?....

    I always use this little function provided my Microsoft to make-safe any data entered my users.<BR><BR>Function JetSQLFixup(TextIn) <BR> Dim Temp<BR> Temp = Replace(TextIn, "&#039", "&#039&#039")<BR> JetSQLFixup = Replace(Temp, "&#124", "&#039 & chr(124) & &#039") <BR>End Function<BR><BR>Hope that helps<BR><BR>Pete

Posting Permissions

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