Results 1 to 4 of 4

Thread: Apostrphe Usage

  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: Apostrphe Usage

    How do you allow clients to enter text that contains an apostrophe?
    Thanks!

  2. #2
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    81
    since the udfunctions were invented, it's not more a problem.
    --
    kukuk

  3. #3
    Join Date
    Apr 2003
    Posts
    114

    BUt...

    ...my clients are having trouble entering data if it contains apostrophes. Here is the code that they are using:

    sql = "INSERT INTO TrainingData (PartID, TrngDate, TimeDay, Effort, UnitMeas, Partners, Comments, DateSubmt) "

    sql = sql & "VALUES (" & Session("partid") & ", '" & CDate(strDateRun) & "', '" & Request.Form("ampm") & "', " & CInt(strEffort)

    sql = sql & ", '" & strUnitMeas & "', '" & Request.Form("partners") & "', '" & Request.Form("comments") & "', '" & Date & "')"

    Set rs = conn.Execute(sql)
    Set rs =Nothing


    If the comments or partners field contains an apostrophe, we seem to have a problem. How should I modify my code?

    Thanks for your time!!!!

  4. #4
    Join Date
    Jun 2003
    Posts
    3
    If you need to insert apostrophies in SQL, make it a double apostrophie.
    Like...

    Insert into Table (Field1) Values ('That''s That')

    In VB, just use:
    Replace(sSQL,"'","''")

    Works like a charm

    Hope this helps.

Posting Permissions

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