Storing multi paragraphed "Memo's" in a database (Access)
-
I've got a posting system where you type your spiel into a text area, much like this posting system works. It stores this into a memo in an access database. But when i pull it out to put it in a post, it's all in one big chunk of text. What can i do to maintain formatting? Cheers Cata
-
I've got a posting system where you type your spiel into a text area, much like this posting system works. It stores this into a memo in an access database. But when i pull it out to put it in a post, it's all in one big chunk of text. What can i do to maintain formatting? Cheers Cata
Hi Cata. Well, you could just store the html formatting tags in your memo field as text too - Access wouldn't care, it would just treat it as text.
-
Hi Cata. Well, you could just store the html formatting tags in your memo field as text too - Access wouldn't care, it would just treat it as text.
Ahhh, i thought it might have been something like that. But what do i do, i don't want people to have to insert HTML tags into the text. I could, i suppose, change the insert textbox fetch, into a function call that inserts the HTML
tags... That about right? Cata
-
Ahhh, i thought it might have been something like that. But what do i do, i don't want people to have to insert HTML tags into the text. I could, i suppose, change the insert textbox fetch, into a function call that inserts the HTML
tags... That about right? Cata
The Catalyst wrote: But what do i do, i don't want people to have to insert HTML tags into the text Hi Cata. That's interesting... how are your users entering the formatted text now? I assumed (perhaps incorrectly :) ) that the source for the memo field was web-based data entry in something like a <textarea>.
-
The Catalyst wrote: But what do i do, i don't want people to have to insert HTML tags into the text Hi Cata. That's interesting... how are your users entering the formatted text now? I assumed (perhaps incorrectly :) ) that the source for the memo field was web-based data entry in something like a <textarea>.
The text wasn't formatted. It was in a text area. I put together a little DLL that prefixes "
" and post fixes "
" at the beginning and end of the document. Then replaces all instances of "\n" with "
" It's worked fine :) I'm curious, in asp.net, can people input script via a text box? I assume that if the page runs anything pulled from text, it could contain complex HTML or Javascript designed to screw a site up, but this wouldn't work with server side script would it? Seing how it has to be compiled.... Just curious Cata
-
I've got a posting system where you type your spiel into a text area, much like this posting system works. It stores this into a memo in an access database. But when i pull it out to put it in a post, it's all in one big chunk of text. What can i do to maintain formatting? Cheers Cata
This is the definitive answer. TextArea boxes in forms generate vbCrLf's (carriage return line feeds) every time you hit enter. So 2 hits of the enter button and you have a new paragraph. Well, sounds like you're just storing the raw data into Access and then pulling it out onto the page. IF you do that there will be no formatting displayed. But if you look at your source you will see that the returns are there. So, what you do is leave it formated as is in the database. Change the display page code to look like:
<% myData = rs.Field("somefield").value 'The below line could just replace with a "< B R >" but I like to keep the return as well as it makes for easier reading of the source code myData = replace(myData, vbCrLf, "< b r >" & vbCrLf) response.write(myData) %>
Obviously the < b r > has no spaces. it wasn't showing in the paost without them. --Tony Archer "I can build it good, fast and cheap. Pick any two."