Forum Moderators: open

Message Too Old, No Replies

Inserting text into a Memo Field using ASP

in a foxpro database

         

kosmoraios

8:26 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



OK. I've got another one. My form works great. It inserts records, it emails, it slices, it dices. But...Here's what happens. The last field in the table is a Memo field (for "details"). I am using Visual FoxPro 5.0.

When I type anything in the memo field that contains a CR, upon submit, I get this error:

# Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Visual FoxPro Driver]Command contains unrecognized phrase/keyword.
/request.asp, line 90

if I do not hit "enter", it does not give this error, and if I just let it wrap, it appears not to error. Anyone?

Staffa

8:59 pm on Jun 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried :

Replace(Server.HTMLEncode(Request.Form("textarea name")),vbcrlf,"<br>")

when using vbscript or something similar for your code language.

kosmoraios

9:21 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



Doesn't work. I've got:

Replace Server.HTMLEncode(Request.Form("Details")),vbcrlf,"<br>"

near the top of the VB code. Any particular place for it?

Also, it blows up with the same error message when the input exceeds 254 characters .

duckhunter

2:48 am on Jun 3, 2004 (gmt 0)

10+ Year Member



Try Replacing the Chr() codes instead of the vbcrlf. One Replace for the CR another for the LF

strValue = Replace(request("Details"),Chr(10),"")
strValue = Replace(request("Details"),Chr(13),"<BR>")

kosmoraios

5:39 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



Try Replacing the Chr() codes instead of the vbcrlf. One Replace for the CR another for the LF

strValue = Replace(request("Details"),Chr(10),"")
strValue = Replace(request("Details"),Chr(13),"<BR>")

Ok. I did that - verbatim - near the top of the VB script. Do I need to replace strValue with strDetails or whatever? Also, is there a particular place that I need to put this code?

Also, someone suggested creating another table to hold the memo field. What to you think about that?

kosmoraios

5:41 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



I am beginning to think that this is perhaps an issue with the ODBC driver for Visual FoxPro. I am going to upgrade to MDAC 2.8 today and see if that changes anything. Has anyone else experienced anything similar to this?

duckhunter

1:27 am on Jun 4, 2004 (gmt 0)

10+ Year Member



Even SQL Server balks sometimes at CRLF's in text fields. I've seen a tables get corrupted because of this.

Removing the Chr 10 & 13 I reference above is the approach that cures the problem.

kosmoraios

2:31 pm on Jun 4, 2004 (gmt 0)

10+ Year Member



duckhunter - 2 questions.

1. Where do I put the code
2. Do I need to replace strValue with strDetails?

I have it currently exactly as you typed it near the beginning of the VB script. It doesn't seem to fix the problem. I have an MS KB article (208208) that says that I have to use the AppendChunk() method in order to make it work through the ODBC driver. I seriously appreciate your help!

duckhunter

10:40 pm on Jun 4, 2004 (gmt 0)

10+ Year Member



I'm not up on FoxPro but if AppendChunk fixes it then that's how you need to update/insert into that type of field (text). Sorry the Replace Chr10 & 13 didn't fix it. That does it for SQL Server. Try the AppendChunk method as you mention. Might just be an ODBC/FoxPro hitch.

kosmoraios

2:07 pm on Jun 11, 2004 (gmt 0)

10+ Year Member



Appendchunk does not fix the line break issue.

It HAS to be something with replacing the Chr(10) and (13) codes. I think I just may have it wrong.

Here's what I've got:


strDetails=Request.Form("Details")
strDetails=Replace(request("Details"),Chr(10),"")
strDetails=Replace(request("Details"),Chr(13),"<BR>")

duckhunter

3:15 am on Jun 12, 2004 (gmt 0)

10+ Year Member



Your dropping your first Replace by using the request("Details") in your second Replace which is leaving the carriage return in the string (Chr(10)) Use this.

strDetails=Request.Form("Details")
strDetails=Replace(strDetails,Chr(10),"")
strDetails=Replace(strDetails,Chr(13),"<BR>")