Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 4th, 2004, 09:00 AM
Authorized User
 
Join Date: Jun 2003
Location: Gulfport, Ms, USA.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default Forms and Database Entries

When using forms to enter information into a database, what do you have to do to have the info entered exactly as you typed it in the form, such as pagebreaks, carriage returns, and the like.

Currently, if I enter info into a form such as:
Hi world,
I love p2p.wrox.com.
Chris

It enters into the database and when I pull it out for display it comes out as:
Hi world, I love p2p.wrox.com. Chris

I want it to store and return out exactly as I originally entered it.
Reply With Quote
  #2 (permalink)  
Old June 4th, 2004, 09:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

OK, before writing the data into the table, replace all VBCRLF with "<br>" in that Form variable. That should produce what you wanted.

Code:
Replace(Request.Form("txtField"),vbCRLF,"<br>")
Cheers!



_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #3 (permalink)  
Old June 4th, 2004, 10:01 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Alternatively, you could use this code when you display the information, instead of when you save it in the database.

By transforming it when you display it, you can keep the data in the database application independent, so it's easier to reuse in other type of applications (export to Word, Excel, for example).

However, doing the transformation when you display the data means a performance hit, as you have to do it every time you retrieve and display the info. If you're really sure you're never going to reuse the information in another application, you could transform the data when you save it; in all other cases I think it's better to do it when you display it.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #4 (permalink)  
Old June 4th, 2004, 10:11 AM
Authorized User
 
Join Date: Jun 2003
Location: Gulfport, Ms, USA.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Thanks guys! That's exactly what I was looking for. As far as saving the formatted data, under normal circumstances I won't have to worry about it. There are times that I can see that I may not want to pre-format the data so thanks for bringing that up. Thanks again!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to print out database entries... Teessider_2000 Beginning PHP 0 June 29th, 2007 02:58 PM
Automatic Entries on Forms taraj Access VBA 2 June 16th, 2006 07:37 AM
SQL Database storing entries in GMT Time rijahs SQL Server 2000 1 June 7th, 2006 01:50 PM
Remove entries from listview and database on click neo_jakey Pro VB Databases 1 September 20th, 2004 12:21 PM
Remove entries from listview and database on click neo_jakey VB Databases Basics 2 September 20th, 2004 10:37 AM



All times are GMT -4. The time now is 11:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.