READING FROM Access97: single quote problem

Results 1 to 3 of 3

Thread: READING FROM Access97: single quote problem

  1. #1
    Join Date
    Dec 1969

    Default READING FROM Access97: single quote problem

    My problem is this:<BR><BR>data is entered into forms and then inserted into an Access database. there is a potential for the entering of single-quote data (i.e., under ProjectTitle field, "Stan&#039s Projects") ...i have resolved the problem of writing a single quote to the database (adding to the single quote in the string another single quote, making it a double quote and thereby bypassing the error)...the data "Stan&#039s Projects" now exists in the database exactly as the user entered it <BR><BR>the problem occurs when we read this record from Access. in trying to display the project information (in this case, displaying it in a form&#039s textbox) over the web, the application (i&#039m not sure whether ASP, Access, or one of the db drivers is doing this) cuts off all the record data it encounters after and including the single quote<BR><BR>for instance, if 3 fields exist in the db table, and 1 record includes the errant single-quote as above: <BR>ProjectNo ProjectTitle Reason <BR>007 Stan&#039s Projects just because<BR><BR> <BR>now i try to view the above 3 fields in table format over the web (reading the data into 3 textboxes), the output to the browser would look like this<BR><BR>ProjectNo ProjectTitle Reason <BR>007 Stan<BR><BR>is there any fix/workaround for this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: READING FROM Access97: single quote problem

    Look at the html that is generated, the cause of the problem should be clear...<BR>value=&#039stan&#039s project&#039<BR>The fix is a js escape character -&#062; "\"<BR>value=&#039stan&#039s project&#039

  3. #3
    Join Date
    Dec 1969

    Default Not Access...surely your HTML and the browser...

    Do a VIEW &#124 SOURCE of the HTML page you have the problem with. Look down at the place with the problem.<BR><BR>You said "trying to display in a form&#039s textbox", so *probably* you will see something like this:<BR><BR>&#060;INPUT Type=&#039Text&#039 Name=&#039Whatever&#039 Value=&#039Stan&#039s Projects&#039&#062;<BR><BR>See it? One easy solution: Convert to <BR><BR>&#060;INPUT Type="Text" Name="Whatever" Value="Stan&#039s Projects"&#062;<BR><BR>Solves the problem until you find a field that has a " in it. At which point you get to start HTMLEncoding the values.<BR><BR><BR><BR>

Posting Permissions

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