Problem with inserting field (with embedded single

Results 1 to 2 of 2

Thread: Problem with inserting field (with embedded single

  1. #1
    vxb11 Guest

    Default Problem with inserting field (with embedded single

    I am trying to insert values from a name text field (on an ASP form) into an MS Access database. However whenever there is a single quote in the name field (say O&#039Donell) & I try to insert that value into the database I encounter errors. Access sees single quotes as delimiters & that is why I get the error.<BR><BR>I tried using Left & Right funcitons to extract the single quotes & appending another single quote in front of it so that Access recognizes the first one as a delimiter and the second one as part of the value but that does not seem to work (I am using Visual Interdev to write the asp pages). I am attaching the code below.<BR>Need some help asap..!<BR><BR>*********Code below ********************<BR><BR>fname=Request.Form("fn ame") //fname is the field where I enter the name say Dan O&#039Donell<BR>if instr(fname,"&#039") then<BR> lengt= len(fname)<BR> delimi = instr(fname,"&#039")<BR> remainde = lengt-delimit<BR> fname = left(fname,delim-1) & "&#039&#039" & right(fname,remainde) <BR>//Left & Right functions above not being recognized when I try to append two single quotes together<BR><BR> session("fname") = fname<BR> lengt=0<BR> delimi=0<BR> remainde=0<BR>else<BR> session("fname") = fname<BR>end if

  2. #2
    Karl Guest

    Default RE: Problem with inserting field (with embedded si

    Common problem with a simple solution...<BR><BR>First though, you could do it your way, but that&#039s quite complicated. <BR><BR>try:<BR>replace(fname, "&#039", "&#039&#039")<BR><BR>then before displaying the information pull a 180<BR>replace (fname, "&#039&#039", "&#039")<BR><BR>hope that helps<BR>--<BR>Karl

Posting Permissions

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