aprostophe 
Author Message
 aprostophe

Hi,
I have a web page that retrieves user input and updates an
sql databased using ASP page. But everytime the text input
field includes an aprostophe it gives the error message:

Microsoft OLE DB Provider for ODBC Drivers
error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
Incorrect syntax near 't'.

/IHealthlogs/submitfault.asp, line 23

If there is an aprostophe within the input string it is
picked up as part of the code.

IS there a code to totally ignore the string?

please help

thanks in advance
Nuve



Sat, 17 Jul 2004 09:07:12 GMT  
 aprostophe
Ya, Check out the Replace function.

Dim myVal
myVal = "Person's name"
myVal = Replace(myVal, "'", "~")    'I replaced it with a ~ character

'now store it in the database


Quote:
> Hi,
> I have a web page that retrieves user input and updates an
> sql databased using ASP page. But everytime the text input
> field includes an aprostophe it gives the error message:

> Microsoft OLE DB Provider for ODBC Drivers
> error '80040e14'

> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
> Incorrect syntax near 't'.

> /IHealthlogs/submitfault.asp, line 23

> If there is an aprostophe within the input string it is
> picked up as part of the code.

> IS there a code to totally ignore the string?

> please help

> thanks in advance
> Nuve



Sat, 17 Jul 2004 10:25:54 GMT  
 aprostophe
You can use the Replace() function to replace all occurrences of a single
quotation mark with *two* single quotation marks:

To borrow Bryan's example:

Dim myVal
myVal = "Person's name"
myVal = Replace(myVal, "'", "''")

'now store it in the database

This will store it in the database with an embedded apostrophe.  This
doesn't answer your question about ignoring it, but gives you a potential
alternative.


Quote:
> Hi,
> I have a web page that retrieves user input and updates an
> sql databased using ASP page. But everytime the text input
> field includes an aprostophe it gives the error message:

> Microsoft OLE DB Provider for ODBC Drivers
> error '80040e14'

> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
> Incorrect syntax near 't'.

> /IHealthlogs/submitfault.asp, line 23

> If there is an aprostophe within the input string it is
> picked up as part of the code.

> IS there a code to totally ignore the string?

> please help

> thanks in advance
> Nuve



Sat, 17 Jul 2004 10:41:58 GMT  
 aprostophe
OR...

myVal = Replace(myVal, "'", "''")    will replace the ' with '' (not
quotations but double apostrophe)

this will leave your dbase entry in english....


Quote:
> Ya, Check out the Replace function.

> Dim myVal
> myVal = "Person's name"
> myVal = Replace(myVal, "'", "~")    'I replaced it with a ~ character

> 'now store it in the database



> > Hi,
> > I have a web page that retrieves user input and updates an
> > sql databased using ASP page. But everytime the text input
> > field includes an aprostophe it gives the error message:

> > Microsoft OLE DB Provider for ODBC Drivers
> > error '80040e14'

> > [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
> > Incorrect syntax near 't'.

> > /IHealthlogs/submitfault.asp, line 23

> > If there is an aprostophe within the input string it is
> > picked up as part of the code.

> > IS there a code to totally ignore the string?

> > please help

> > thanks in advance
> > Nuve



Sat, 17 Jul 2004 23:55:36 GMT  
 
 [ 4 post ] 

 Relevant Pages 
 

 
Powered by phpBB® Forum Software