View Full Version : Anybody here used Access as backend for ASP web based app?
silab
10-22-2002, 11:34 PM
I just have a question for you.
In one table in Access, one of the fields has a memo field. In one of the forms, i add data to that table in a certain formatted way.
Now, i wanted to display that in the web and using ASP i have done it successfully BUT it removes the formatting. It puts all in that field (memo type) into one paragraph. Is there any way I can retain it?
Thanks
whammy
10-22-2002, 11:39 PM
You can retain the line breaks and stuff:
<% = Replace(Server.HTMLEncode(myfield),vbCrLf,"<br />") %>
Also, if you paste it into a textarea it will retain that formatting.
If you want to retain any other type of formatting (such as HTML), you have to enter that into the database.
:)
silab
10-23-2002, 04:18 AM
OK so this line of code will be inserted in the ASP page
<% = Replace(Server.HTMLEncode(my memo field),vbCrLf,"<br />") %>
WOW very fast. I am so happy i found this forum.
I'll try that dude. Thanks
whammy
10-24-2002, 12:51 AM
That was just an example... but yeah that should work... of course:
<% = blah %>
is just a shortcut in ASP for:
<% Response.Write(blah) %>
:D
silab
10-25-2002, 09:41 AM
Yes it did work :)
You are so awesome!
Anyways i got another question somewhat related to this.
Now my dilemma is i entered something on the page (ASP page) in the text area. Something like this
Nokia releases crappy phones like the following
1) 8250
2) 8310
3) 6510
But when i tried to save that into the access data field (memo), it always give me something like error in the last row. But when i jsut enter one paragraph, it saves it. Is there any way I can do it properly retaining the format from the page to the database?
Thanks
silab
10-25-2002, 05:04 PM
Anyways, i was able to get this line to work from ASP page
Story = Replace(Story1,chr(13) & chr(10), "<br>")
However what happens now is, the memo field contains <br> in the database. So the problem now is when the user opens up the form and try to edit this memo field, he will see those <br> instead of the new line.
Is there any way in the ASP page I can make more than 1 lines of code stored in the database without those <br> stuff and just normal text in that field? Or is this a helpless case?
rcreyes
10-26-2002, 03:37 AM
You could strip all carriage returns to either a space or blank character before saving the value into the table, for example
data = Replace(dataentered, chr(13), "")
update tbl set fieldname = data
whammy
10-26-2002, 04:39 AM
Well, that is the same kind of deal...
you have vbCrLf = that is a "carriage return" AND "line feed"
Also you have VbCr which is just a carriage return, and Vblf which is just a line feed. Since XML and standards are going towards just a line feed, I am working with that to see how it goes. So far no problems. :D
silab
10-26-2002, 09:04 AM
rcreyes, i know so basically when i did your suggestion it went like this
i entered this on the web (text area)
Hello
how are you
now?
When i did ur suggestion, it will go like
hello how are you now?
But what i wanted to do was retain the format however I entered it on the web and saved as is on the memo field in access without adding any HTML code. Just like how the data is saved in that memo field using Access form. Do you know what i meant?
and sorry whammy, i didnt quite understood what you said there :o
whammy
10-26-2002, 04:16 PM
If you just plain store it in the database, like you were in the first place, and only do this:
<% = Replace(Server.HTMLEncode(my memo field),vbCrLf,"<br />") %>
when you display it to the page, you won't have any problems.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.