Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / October 2006

Tip: Looking for answers? Try searching our database.

Inserting statement with single quote

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kamuixkotori - 23 Oct 2006 07:27 GMT
Hello,

Does anyone know how to insert/update data that contains single quote (')
into a field? Data such as: John's house is in Dalas.

I know one can insert double quote by using single quotes as field
delimiters.  But since I have to use single quotes as field delimiters, data
cannot contain single quote.  Is there a way to change the field delimiter?

I try escaping the single quote by adding a "\" before the single quote like
the example below, but it still won't work? why? I using Microsoft Access.

'John\'s house is in Dalas'
Damian S - 23 Oct 2006 07:53 GMT
Hi kamuixkotori,

You need to replace single quotes in your SQL String with two single quotes...

eg: strSQL = replace(strSQL, "'", "''")

that's double quote, single quote, double quote
then double quote, two single quotes, double quote

Hope this helps.

Damian.

> Hello,
>
[quoted text clipped - 9 lines]
>
> 'John\'s house is in Dalas'
kamuixkotori - 23 Oct 2006 08:46 GMT
In the SQL view of Microsoft Access it can work.. but in java runtime it give
'java.sql.SQLException: General error' error message.. how come?

> Hi kamuixkotori,
>
[quoted text clipped - 22 lines]
> >
> > 'John\'s house is in Dalas'
kamuixkotori - 23 Oct 2006 09:47 GMT
Hmm.. btw.. it can work already.. thanks a lot!

> In the SQL view of Microsoft Access it can work.. but in java runtime it give
> 'java.sql.SQLException: General error' error message.. how come?
[quoted text clipped - 25 lines]
> > >
> > > 'John\'s house is in Dalas'
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.