|
 |
asp_web_howto thread: Inserting data
Message #1 by <ramliabdel@y...> on Wed, 24 Jan 2001 22:24:50 +0100
|
|
Hi all,
I've got a basic problem that I'm sure one of you will solve in a minut
I'm using an Access DB and inserting data into it from the an ASP web page
The thing is my fields do not support the ' caracters
Like if I enter :
I'm
it returns an error message
what should I do, to make the fields accept anything ?
Message #2 by Scott Watermasysk <swatermasysk@C...> on Wed, 24 Jan 2001 17:11:20 -0500
|
|
It might be just me, but I am not sure your question came throught
correctly.
What characters isn't it accepting?
Message #3 by Imar Spaanjaars <Imar@S...> on Wed, 24 Jan 2001 23:22:59 +0100
|
|
The data-engine sees the ' as a delimiter for string / varchar fields.
Therefore, you need to replace one ' with ''
Try this before you create your SQL statement.
sInsert = "I'm"
sInsert = Replace(sInsert, "'", "''")
This replaces all occurrences of one apostrophe (') with two of them ('')
so now sInsert will be "I''m" and your insert should work.
HtH
Imar
At 10:24 PM 1/24/2001 +0100, you wrote:
>Hi all,
>
>I've got a basic problem that I'm sure one of you will solve in a minut
>
>I'm using an Access DB and inserting data into it from the an ASP web page
>
>The thing is my fields do not support the ' caracters
>Like if I enter :
>I'm
>it returns an error message
>
>what should I do, to make the fields accept anything ?
Message #4 by "Wally Burfine" <oopconsultant@h...> on Wed, 24 Jan 2001 22:19:09 -0000
|
|
Sounds like the old quotes mark vs quote mark ... problem. Change the single
quote to 2 single quotes in the variable.
Message #5 by "Erik Coleman" <ecoleman@e...> on Wed, 24 Jan 2001 16:18:00 -0600
|
|
I'm think he's asking how to insert comma's into a field with out breaking
the resulting SQL statement. ex.
INSERT INTO tablename (field1, field2) VALUES ('It's alive', 'value2')
(notice the quote in "It's")
Personally I always just strip quote away but does anyone know of a way to
encode it so it will be inserted without causing the SQL string to throw a
error?
Thanks
Message #6 by "Gerhard Wentink" <wentink@w...> on Thu, 25 Jan 2001 06:12:53 +0100
|
|
When I insert text in a database that will be used in a html page afterwards
I replace all quotes with &rsquot; etc.
Works ok.
Function replaceQuote(strRep)
Dim strFirst
Dim strFinal
strFirst=Replace(strRep,"'","’")
strFinal=Replace(strFirst,"""",""")
replaceQuote=strFinal
End Function
Gerhard Wentink
wentink@w...
www.webset.nl
----- Original Message -----
From: <ramliabdel@y...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Wednesday, January 24, 2001 10:24 PM
Subject: [asp_web_howto] Inserting data
> Hi all,
>
> I've got a basic problem that I'm sure one of you will solve in a minut
>
> I'm using an Access DB and inserting data into it from the an ASP web page
>
> The thing is my fields do not support the ' caracters
> Like if I enter :
> I'm
> it returns an error message
>
> what should I do, to make the fields accept anything ?
>
>
Message #7 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Thu, 25 Jan 2001 10:00:49 -0000
|
|
replace ' with ''
don't worry, what actually goes into the database is it's, not it''s, so you
will not experience problems reading the data back.
-----Original Message-----
From: ramliabdel@y... [mailto:ramliabdel@y...]
Sent: Wednesday, January 24, 2001 9:25 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Inserting data
Hi all,
I've got a basic problem that I'm sure one of you will solve in a minut
I'm using an Access DB and inserting data into it from the an ASP web page
The thing is my fields do not support the ' caracters
Like if I enter :
I'm
it returns an error message
what should I do, to make the fields accept anything ?
Message #8 by "Mike Scott" <jstmehr4u3@h...> on Thu, 25 Jan 2001 22:02:59 -0800
|
|
The single apostrophe ' will cause a sql error. One post earlier was correct
with using the double apostrophe '' (not quotes " although visually no
difference) this will tell SQL to expect a single apostrophe ' as still
being part of the string.
----- Original Message -----
From: "Erik Coleman" <ecoleman@e...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Wednesday, January 24, 2001 2:18 PM
Subject: [asp_web_howto] RE: Inserting data
> I'm think he's asking how to insert comma's into a field with out breaking
> the resulting SQL statement. ex.
> INSERT INTO tablename (field1, field2) VALUES ('It's alive', 'value2')
> (notice the quote in "It's")
>
> Personally I always just strip quote away but does anyone know of a way to
> encode it so it will be inserted without causing the SQL string to throw a
> error?
> Thanks
|
|
 |