Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DHTMLEdit and MS Access

0 views
Skip to first unread message

Corey Burnett

unread,
Nov 25, 1998, 3:00:00 AM11/25/98
to
I am trying to use the DHTMLEdit control and save the content to a MS Access
database. I have used it successfully with a MS SQL Server database.
However when I use a memo field in Access to hold the HTML content I get
errors. Here is what seems to happen.

I can save the content to the database with no problems. But when I then
try to go back and edit the document a second time I get an error when I am
trying to load the content into the DHTMLEdit control. It fails on the
following line of code:

tbContentElement.DocumentHTML =
'<html><body><cfoutput>#myDocument#</cfoutput></body></html>';

The error that I receive is a JavaScript error about an unterminated string
constant. I am using ColdFusion and at run time the
<cfoutput>#myDocument#</cfoutput> text is replaced with the content from the
database. I have verified that this is happening correctly. I think that
what is happening is that Access is not saving the content as one long
continuous string. It is inserting carriage returns and line feeds. I have
tried to write some code that removes all carriage returns and line feeds
before the content is saved to the database and after it is pulled from the
database:

<cfset myDocument = rsDocument.ProductContent>
<cfloop index="iCount" from="0" to="31">
<cfset myDocument = Replace(myDocument, chr(iCount), " ")>
</cfloop>

I realize that this script is written in Cold Fusion and not ASP, however I
believe that this should remove all carriage returns and line feeds
(chr(13), chr(10)).

I did not have this problem with SQL Server. Could Access be adding its own
carriage returns and line feeds?

Thanks for your help,

Corey Burnett
cbur...@iconixgroup.com

Corey Burnett

unread,
Nov 25, 1998, 3:00:00 AM11/25/98
to
Just a case of STUPID PROGRAMMER!

My code for removing the unprintable characters was flawed. I was only
removing the first occurence of each unprintable character. I simply
modified the loop and now it works perfectly.

A warning however. Access seems to insert its own carriage returns and line
feeds into a memo field, so you must remove them yourself before you try to
set the tbContentElement.DocumentHTML.

Corey


Corey Burnett wrote in message
<#fNH9CIG#GA....@uppssnewspub05.moswest.msn.net>...

Bo

unread,
Nov 27, 1998, 3:00:00 AM11/27/98
to
Your problem probably is that there are quotes ( " ) in the html
source from the dhtml control (there is!)

The access oledb /odbc driver won't accept this.

My solution to that was to replace the ' and " character with
something else before storing to access. like this: (vbscript)

function unquote (inhtml)
t = len(inhtml)
DQuote = chr(34)
SQuote = chr(39)
DReplace = chr(135)
SReplace = chr(134)
unquote = ""
for ct = 1 to t
tt = mid(inhtml, ct, 1)
if tt = DQuote Then tt = DReplace
if tt = SQuote Then tt = SReplace
unquote = unquote + tt
next
end function

...
and when you retrieve...


function requote (inhtml)
t = len(inhtml)
DQuote = chr(34)
SQuote = chr(39)
DReplace = chr(135)
SReplace = chr(134)
requote = ""
for ct = 1 to t
tt = mid(inhtml, ct, 1)
if tt = DReplace Then tt = DQuote & DQuote
if tt = SReplace Then tt = SQuote
requote = requote + tt
next
end function

hope this helps

bo

0 new messages