Inserting single quote to database

Results 1 to 2 of 2

Thread: Inserting single quote to database

  1. #1
    KatieG Guest

    Default Inserting single quote to database

    Hi,<BR><BR>I use an SQL INSERT statement to insert form data into my Access Database.<BR>How do I avoid an error if a user enters a single quote symbol into a from field???<BR>I code looks like this:<BR><BR>&#039;save form details to database<BR>dim rname, message<BR>rname = RS.Fields("R_Name").Value<BR>message = RS.Fields("Message").Value<BR>set conn = server.createobject("adodb.connection")<BR>conn.op en "myconn"<BR>SQLstmt = "INSERT INTO Postcards (R_Name,Message)"<BR>SQLstmt = SQLstmt & "VALUES ("<BR>SQLstmt=SQLstmt & "&#039;" & rname & "&#039;,"<BR>SQLstmt=SQLstmt & "&#039;" & message & "&#039;"<BR>SQLstmt=SQLstmt & ")"<BR>Set RS = conn.execute(SQLstmt)<BR>conn.close<BR>set conn = nothing <BR><BR>Thanks in advance,<BR><BR>Katie<BR><BR><BR>

  2. #2
    Ed Guest

    Default FAQs!!

Posting Permissions

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