Author |
Topic  |
|
Bookie
Average Member
  
USA
856 Posts |
Posted - 06 February 2002 : 11:57:08
|
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 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 06 February 2002 : 15:50:09
|
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 ====== |
 |
|
Bookie
Average Member
  
USA
856 Posts |
Posted - 07 February 2002 : 08:48:02
|
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 |
 |
|
Kat
Advanced Member
    
United Kingdom
3065 Posts |
|
SimonT
Junior Member
 
United Kingdom
202 Posts |
Posted - 07 February 2002 : 15:00:16
|
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.. |
 |
|
Steve D.
Average Member
  
USA
640 Posts |
Posted - 19 February 2002 : 16:12:26
|
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 |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 19 February 2002 : 18:03:52
|
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.
|
 |
|
|
Topic  |
|