|
 |
asp_web_howto thread: Quicky RE Replace function
Message #1 by "Joe" <joe@k...> on Fri, 19 Apr 2002 11:52:30
|
|
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
Message #2 by "Alex Shiell, ITS, EB, SE" <alex.shiell@s...> on Fri, 19 Apr 2002 12:26:32 +0100
|
|
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
Message #3 by Joe Ingle <Joe@k...> on Fri, 19 Apr 2002 13:54:26 +0100
|
|
Thanks Alex
I now have this:
Function StripApostrophe(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "'"
.Global = True
StripApostrophe = objRegExp.Replace(Expression, "''")
End With
Set objRegExp = Nothing
End Function
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = objRegExp.Replace(Expression, "<BR>")
End With
Set objRegExp = Nothing
End Function
txtInputValue
FormatForDB(StripApostrophe(request.form("txtInputValue")))
Which is fantastic as I can pull in the functions in an include and it's
drastically cut down code on the page.
Thanks very much.
Joe
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 12:27 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #4 by Shaun Steckley <SSTECKLEY@P...> on Fri, 19 Apr 2002 09:01:58 -0400
|
|
Here is a "Getting Started" article for VB or VBScript that I found...
http://www.a1vbcode.com/vbtip.asp?ID=78
Shaun
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 7:27 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
********************************************************************
The information contained in this email is confidential and
is intended solely for the use of the person identified and
intended as the recipient. If you are not the intended
recipient, any disclosure, copying, distribution, or taking of
any action in reliance on the contents is prohibited. If you
receive this message in error, contact the sender
immediately and delete it from your computer.
Personal e-mails are restricted by PSECU policy. As such,
PSECU specifically disclaims any responsibility or liability
for any personal information or opinions of the author
expressed in this email.
********************************************************************
Message #5 by "Alex Shiell, ITS, EB, SE" <alex.shiell@s...> on Fri, 19 Apr 2002 14:06:49 +0100
|
|
Why not put your stripapostrophe function into the formatfordb function, as
you'll always need to do that too?
Of course if you're wanting to put HTML into your database, don't forget
about the other characters that need to be converted too... how about good
old Server.HTMLEncode()?
-----Original Message-----
From: Joe Ingle [mailto:Joe@k...]
Sent: 19 April 2002 13:54
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Thanks Alex
I now have this:
Function StripApostrophe(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "'"
.Global = True
StripApostrophe = objRegExp.Replace(Expression, "''")
End With
Set objRegExp = Nothing
End Function
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = objRegExp.Replace(Expression, "<BR>")
End With
Set objRegExp = Nothing
End Function
txtInputValue
FormatForDB(StripApostrophe(request.form("txtInputValue")))
Which is fantastic as I can pull in the functions in an include and it's
drastically cut down code on the page.
Thanks very much.
Joe
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 12:27 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
Message #6 by Joe Ingle <Joe@k...> on Fri, 19 Apr 2002 14:19:26 +0100
|
|
Stupid question, but how do I do that? Can you nest functions?
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 2:07 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Why not put your stripapostrophe function into the formatfordb function, as
you'll always need to do that too?
Of course if you're wanting to put HTML into your database, don't forget
about the other characters that need to be converted too... how about good
old Server.HTMLEncode()?
-----Original Message-----
From: Joe Ingle [mailto:Joe@k...]
Sent: 19 April 2002 13:54
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Thanks Alex
I now have this:
Function StripApostrophe(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "'"
.Global = True
StripApostrophe = objRegExp.Replace(Expression, "''")
End With
Set objRegExp = Nothing
End Function
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = objRegExp.Replace(Expression, "<BR>")
End With
Set objRegExp = Nothing
End Function
txtInputValue
FormatForDB(StripApostrophe(request.form("txtInputValue")))
Which is fantastic as I can pull in the functions in an include and it's
drastically cut down code on the page.
Thanks very much.
Joe
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 12:27 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #7 by "Alex Shiell, ITS, EB, SE" <alex.shiell@s...> on Fri, 19 Apr 2002 14:26:12 +0100
|
|
not in vbscript (you can in javascript) - and besides you might want to use
it elsehwere anyway... I just meant put the function call inside the other
function, as you would always need to strip appostrophes when formatting for
DB
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = StripApostrophe(objRegExp.Replace(Expression, "<BR>"))
End With
Set objRegExp = Nothing
End Function
-----Original Message-----
From: Joe Ingle [mailto:Joe@k...]
Sent: 19 April 2002 14:19
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Stupid question, but how do I do that? Can you nest functions?
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 2:07 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Why not put your stripapostrophe function into the formatfordb function, as
you'll always need to do that too?
Of course if you're wanting to put HTML into your database, don't forget
about the other characters that need to be converted too... how about good
old Server.HTMLEncode()?
-----Original Message-----
From: Joe Ingle [mailto:Joe@k...]
Sent: 19 April 2002 13:54
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Thanks Alex
I now have this:
Function StripApostrophe(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "'"
.Global = True
StripApostrophe = objRegExp.Replace(Expression, "''")
End With
Set objRegExp = Nothing
End Function
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = objRegExp.Replace(Expression, "<BR>")
End With
Set objRegExp = Nothing
End Function
txtInputValue
FormatForDB(StripApostrophe(request.form("txtInputValue")))
Which is fantastic as I can pull in the functions in an include and it's
drastically cut down code on the page.
Thanks very much.
Joe
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 12:27 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
Message #8 by Joe Ingle <Joe@k...> on Fri, 19 Apr 2002 14:39:12 +0100
|
|
I see. Tried it out and it works like a dream.
Thanks again.
Joe
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 2:26 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
not in vbscript (you can in javascript) - and besides you might want to use
it elsehwere anyway... I just meant put the function call inside the other
function, as you would always need to strip appostrophes when formatting for
DB
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = StripApostrophe(objRegExp.Replace(Expression, "<BR>"))
End With
Set objRegExp = Nothing
End Function
-----Original Message-----
From: Joe Ingle [mailto:Joe@k...]
Sent: 19 April 2002 14:19
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Stupid question, but how do I do that? Can you nest functions?
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 2:07 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Why not put your stripapostrophe function into the formatfordb function, as
you'll always need to do that too?
Of course if you're wanting to put HTML into your database, don't forget
about the other characters that need to be converted too... how about good
old Server.HTMLEncode()?
-----Original Message-----
From: Joe Ingle [mailto:Joe@k...]
Sent: 19 April 2002 13:54
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Thanks Alex
I now have this:
Function StripApostrophe(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "'"
.Global = True
StripApostrophe = objRegExp.Replace(Expression, "''")
End With
Set objRegExp = Nothing
End Function
Function FormatForDB(Expression)
Dim objRegExp
Set objRegExp = New RegExp
With objRegExp
.Pattern = "vbCrLf"
.Global = True
FormatForDB = objRegExp.Replace(Expression, "<BR>")
End With
Set objRegExp = Nothing
End Function
txtInputValue
FormatForDB(StripApostrophe(request.form("txtInputValue")))
Which is fantastic as I can pull in the functions in an include and it's
drastically cut down code on the page.
Thanks very much.
Joe
-----Original Message-----
From: Alex Shiell, ITS, EB, SE [mailto:alex.shiell@s...]
Sent: Friday, April 19, 2002 12:27 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Quicky RE Replace function
Replace isn't the most efficient of functions - look into Regular
Expressions
This is a guide to using javascript, but its very simnilar in vbscript.
Consult MSDN for details.
http://www.webreference.com/js/column5/
-----Original Message-----
From: Joe [mailto:joe@k...]
Sent: 19 April 2002 12:53
To: ASP Web HowTo
Subject: [asp_web_howto] Quicky RE Replace function
Hi Guys
At the moment I'm using the following to handle formatting and apostrophes
when adding data to an SQL Server table:
replace(replace(request.form("txtFieldName"), "'" , "''"),
vbCrLf , "<BR>" )
Is there a more efficient method. I know that:
replace(request.form("txtFieldName"), "'" , "''" , vbCrLf , "<BR>")
won't work. It just seems really cumbersome.
Any ideas?
Joe
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
|
|
 |