Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Replace function
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Bookie
Average Member

USA
856 Posts

Posted - 06 February 2002 :  11:57:08  Show Profile  Visit Bookie's Homepage  Send Bookie an AOL message  Send Bookie a Yahoo! Message
Is there a way to do a wholesale replace on a whole querystring inserting into a database? Specific example...

I need to replace all the ' marks in people's names, addresses, cities, etc in a form I have. Rather than doing a...

formfield = Replace(formfield, "'", "''")

... on each field is there a way to do it without harming the sql statement? Thanks in advance.

Bookie

Bookie

"May the forces of evil become confused on the way to your home."
- George Carlin

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 06 February 2002 :  12:07:15  Show Profile  Visit Kat's Homepage
You could use Server.HTMLEncode(the value to encode) instead.

KatsKorner

For Installation help: http://www.aslickpage.com/snitz_help.html

Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 06 February 2002 :  15:50:09  Show Profile
Before you use server.htmlencode, you should decide you want html-altered data in your database, such as < instead of <, " instead of " etc.

Since text fields are delimited by ' in the sql string, there isn't an easy way to do the whole string. For myself, I build in the replace as each field is added to a sql statement.


======
Doug G
======
Go to Top of Page

Bookie
Average Member

USA
856 Posts

Posted - 07 February 2002 :  08:48:02  Show Profile  Visit Bookie's Homepage  Send Bookie an AOL message  Send Bookie a Yahoo! Message
quote:

Before you use server.htmlencode, you should decide you want html-altered data in your database, such as < instead of <, " instead of " etc.

Since text fields are delimited by ' in the sql string, there isn't an easy way to do the whole string. For myself, I build in the replace as each field is added to a sql statement.


======
Doug G
======



That's what I'll probably do. It's not that big of a deal... just a bunch of copy/paste. I was just wondering if there was a really easy way to do it with several hundred fields (not all would use the replace function). Thanks, both of you.


Bookie

"May the forces of evil become confused on the way to your home."
- George Carlin
Go to Top of Page

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 07 February 2002 :  09:14:02  Show Profile  Visit Kat's Homepage
No problem. It should work for what you need

KatsKorner

For Installation help: http://www.aslickpage.com/snitz_help.html

Go to Top of Page

SimonT
Junior Member

United Kingdom
202 Posts

Posted - 07 February 2002 :  15:00:16  Show Profile
I need to do some thing like this (seach and replace)
I am writing a simple sig up load script like at
http://www.imahosting.com/

I want to pull in the user name form my snitz forum and use that as the upload folder the problem is some users have user names that can not be used in folder name like * is there any way to remove these ?
or could I use the member id tag ?

Sorry if this is the wrong place to post this

SimonT

I so wish I could code in ASP..
Go to Top of Page

Steve D.
Average Member

USA
640 Posts

Posted - 19 February 2002 :  16:12:26  Show Profile  Visit Steve D.'s Homepage  Send Steve D. a Yahoo! Message
quote:

Is there a way to do a wholesale replace on a whole querystring inserting into a database? Specific example...

I need to replace all the ' marks in people's names, addresses, cities, etc in a form I have. Rather than doing a...

formfield = Replace(formfield, "'", "''")

... on each field is there a way to do it without harming the sql statement? Thanks in advance.


I just tried this, at least now I don't get errors, when the form is submitted, but the value stored in the database is incorrect.

so if It's is submitted It''s is stored.

do i need to do a replace twice?

----------------------------------------
Badges? We don't need no stinking badges
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 19 February 2002 :  18:03:52  Show Profile  Send ruirib a Yahoo! Message
quote:

I just tried this, at least now I don't get errors, when the form is submitted, but the value stored in the database is incorrect.

so if It's is submitted It''s is stored.

do i need to do a replace twice?

----------------------------------------
Badges? We don't need no stinking badges


Like I asked in the post in the other thread, please post the code you are using for storing the value.
And it would be better to restrain ourselves to a single thread. If you want choose the thread by posting there and inform the admins to close the other.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.63 seconds. Powered By: Snitz Forums 2000 Version 3.4.07