You'll need to replace the quotes before they reach the database, using
something along the lines of;
Saving data;
yourdata = Request.Form("datamessage")
'// Replace quotes with: --
strData = Replace(yourdata, chr(34), "--")
Getting data;
'// replace -- with quotes
strData = Replace(yourdata, "--", chr(34))
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
cooldv <mddv@hotmail.com> wrote in message
news:d356c6c0.0401180906.e14520e@posting.google.co m...[color=blue]
> i know how to replace the sign " when SUBMITTING a form in asp by this
> code:
> message = Replace(usermessage, "'", "''").
>
> My problem is DISPLAYING data in an asp FORM, from an an access
> database, when the data already contains a " sign
>
> problem is like this:
> access database .... to update on the internet .... a *dataupdate.asp*
> page ..... On this page, the data gets displayed in a form where i
> make corrections and then i update it ..... working perfectly; the
> data gets displayed in the form perfectly well and gets updated also[color=green][color=darkred]
> >>> BUT >>>
> >>> PROBLEM >>>[/color][/color]
> If there is a " sign in the data, then all the text beyond the " sign
> is not displayed inside the text box of the form and is obviously lost
> if the form is submitted to update the database.
>
> Also, if data is like this:
> text1 " text2 > text3 text4
>
> then,
> text1 is displayed inside the text box of the form
> text2 is not displayed anywhere as it is after the sign "
> the data beyond the > sign gets displayed, but
> text3 text4 get displayed OUTSIDE the text box of the form as html
> output
>
>
> Here is the code:
>
> <%
> Actionvar=Request.QueryString("actionvar")
>
> Set conn = server.createobject("adodb.connection")
> DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
> DSNtemp=dsntemp & "DBQ=" & server.mappath("database.mdb")
> conn.Open DSNtemp
>
> IF Actionvar="update" THEN
> IF Len(TRIM(Request.Form("flag"))) = 0 THEN
> SQLstmt = "SELECT * FROM database WHERE dataID=" &
> Request.QueryString("Recid")
>
> Set rs = conn.Execute(SQLstmt)
> IF NOT RS.EOF THEN
> %>
>
> <table>
> <FORM METHOD="post" ACTION="dataupdate.asp?Actionvar=update">
> <INPUT TYPE="text" size="78" NAME="dataMessage"
> VALUE="<%=rs("Message")%>">
>
> <INPUT TYPE="hidden" NAME="flag" VALUE="2">
> <INPUT TYPE="hidden" NAME="Recordid" VALUE="<%=rs("dataID")%>">
> <INPUT TYPE="submit" VALUE="Update">
> </form>
> </table>
>
> <%
> rs.MoveNext
> rs.Close
> END IF
> ELSEIF Request.Form("flag")="2" THEN
> comnt = request.form("dataMessage")
> kament = Replace(comnt, "'", "''")
>
> SQLstmt = "UPDATE database SET "
> SQLstmt = SQLstmt & "Message='" & kament & "' "
>
> any help please???
>
> i believe the problem is in how i am displaying data in this part of
> the code:
> <INPUT TYPE="hidden" NAME="Recordid" VALUE="<%=rs("dataID")%>">[/color]