[thelist] cleaning Db for output

Paul Backhouse paul.backhouse at 2cs.com
Wed Dec 5 05:50:46 CST 2001


Anthony - oh the joy of debugging - i hear that!

Also, on information that has been inputed by a user you want to trim and
replace some characters - or you will find yourself in all sorts of
trouble - only "" and '' need replacing (especially in Access).


ADDING TO A DATABASE::::::::::::
<!-- This line replace all ' with '' -->
varFieldOneA = Replace(Trim(Request.Form("FieldOne")), "'","''")
<!-- This line replaces all " with { -->
varFieldOne  = Replace(Trim(varFieldOneA),chr(34),chr(123))

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::

EXTRACTING FROM A DATABASE::::::::::::
<!-- THIS DOES THE REVERSE OF EVERYTHING YOU DID WHEN ADDING TO THE
DATABASE -->
varFieldOneA = Replace(Trim(objRS("FieldOne")), "''","'")
varFieldOne  = Replace(Trim(varFieldOneA),chr(123),chr(34))

cheers

paul

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Anthony Baratta
Sent: 05 December 2001 04:54
To: thelist at lists.evolt.org
Subject: Re: [thelist] cleaning Db for output


At 08:37 PM 12/4/2001, you wrote:

>Following this thread I was wondering if I could put some type of script
>together to clean any possible mistakes up so that I would be able to
>aviod having to code in this fashion?
>
> > varFieldOne = Trim(objRS("FieldOne"))

The main reason for this is that with ADO/ASP, even though the data could
be going in clean - it does not always come out clean. Been through that
hell. Wouldn't wish it on anyone (ok, maybe a couple but nobody on this
list. ;-)
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list