Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Error with insert SQL command


Message #1 by "chung hoang" <chung_h@h...> on Fri, 24 Aug 2001 17:10:32
Hi there,

   I have been having this problem for ages and cannot find any way I can 

deal with it.

At the moment I have a text box for ppl to insert something that will go 

into my access database. However, once the use types in an apostrphere. ' ,

I will get an error.



I was just wonderinf if there is anyway I can prepare for this kinf of 

error??



thanks heaps in advance..



Chung
Message #2 by Steve Carter <Steve.Carter@t...> on Fri, 24 Aug 2001 17:16:33 +0100
u need to replace ' with '' for SQL server.



> -----Original Message-----

> From: chung hoang [mailto:chung_h@h...]

> Sent: 24 August 2001 18:11

> To: ASP Databases

> Subject: [asp_databases] Error with insert SQL command

>

>

> Hi there,

>    I have been having this problem for ages and cannot find

> any way I can

> deal with it.

> At the moment I have a text box for ppl to insert something

> that will go

> into my access database. However, once the use types in an

> apostrphere. ' ,

> I will get an error.

>

> I was just wonderinf if there is anyway I can prepare for

> this kinf of

> error??

>

> thanks heaps in advance..

>

> Chung

Message #3 by "chung hoang" <chung_h@h...> on Fri, 24 Aug 2001 17:59:53
> u need to replace ' with '' for SQL server.

> 

> > -----Original Message-----

> > From: chung hoang [mailto:chung_h@h...]

> > Sent: 24 August 2001 18:11

> > To: ASP Databases

> > Subject: [asp_databases] Error with insert SQL command

> >

> >

> > Hi there,

> >    I have been having this problem for ages and cannot find

> > any way I can

> > deal with it.

> > At the moment I have a text box for ppl to insert something

> > that will go

> > into my access database. However, once the use types in an

> > apostrphere. ' ,

> > I will get an error.

> >

> > I was just wonderinf if there is anyway I can prepare for

> > this kinf of

> > error??

> >

> > thanks heaps in advance..

> >

> > Chung





I meant that when there is an. ' placed into the text box, 

say somebody inserts,    45 a'bekket street, in the text box

I will get an error and it will not insert into my database.



thanks

Chung

Message #4 by Steve Carter <Steve.Carter@t...> on Fri, 24 Aug 2001 18:22:53 +0100
Yep.  So go



SQL = "insert into houses (address) values ('" &

replace(request.form("address"),"'","''") & "')"



(that's all on one line, but I think the list will break it!)



so if they enter a'place then the SQL is



insert into houses (address) values ('a''place')



which SQL server will store in the DB as a'place.





> -----Original Message-----

> From: chung hoang [mailto:chung_h@h...]

> Sent: 24 August 2001 19:00

> To: ASP Databases

> Subject: [asp_databases] RE: Error with insert SQL command

>

>

> > u need to replace ' with '' for SQL server.

> >

> > > -----Original Message-----

> > > From: chung hoang [mailto:chung_h@h...]

> > > Sent: 24 August 2001 18:11

> > > To: ASP Databases

> > > Subject: [asp_databases] Error with insert SQL command

> > >

> > >

> > > Hi there,

> > >    I have been having this problem for ages and cannot find

> > > any way I can deal with it.

> > > At the moment I have a text box for ppl to insert something

> > > that will go into my access database. However, once the use types in 

> > > an apostrphere. ' , I will get an error.

> > >

> > > I was just wonderinf if there is anyway I can prepare for

> > > this kinf of error??

> > >

> > > thanks heaps in advance..

> > >

> > > Chung



Message #5 by "chung hoang" <chung_h@h...> on Sat, 25 Aug 2001 11:23:03

Oh I understand, thanks heaps mate...



Chung


  Return to Index