472,958 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

trouble with sql query and quotes

I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks
Nov 12 '05 #1
2 1416
I solved this by passing sourcefield to a function that replaces the single
quote with 2 quotes.

"Danny" <da********@hotmail.com> wrote in message
news:Kw*******************@news4.srv.hcvlny.cv.net ...
I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks

Nov 12 '05 #2
for x = 1 to infinity
print "Thank you"
next x

LOL, thanks a ton, that did it
"paii, Ron" <pa**@packairinc.com> wrote in message
news:10*************@corp.supernews.com...
I solved this by passing sourcefield to a function that replaces the single quote with 2 quotes.

"Danny" <da********@hotmail.com> wrote in message
news:Kw*******************@news4.srv.hcvlny.cv.net ...
I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
13
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine....
3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
5
by: Fernando Rodríguez | last post by:
Hi, I'm sending the follwoing query to mysql from a php script: ---------------------------------------------------------------------------------------- INSERT INTO affiliates (aff_id,...
3
by: mukeshhtrivedi | last post by:
Hi Gurus, I have created simple query as SELECT QUOTES.DATE, QUOTES.QUOTENO, QUOTES.SALESREP, QuoteItem.ITEM, QUOTES., QUOTES.CUSTOMER, QUOTES.AMOUNT, QUOTES., QUOTES.DivisionID,...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
12
by: Todd Michels | last post by:
Hi all, I am trying to send data from a form and insert it into a MSSQL DB. When I submit the data I get: Warning: mssql_query() : message: The name "Todd" is not permitted in this context....
9
by: Nathan Sokalski | last post by:
I am trying to use the System.Array.ForEach method in VB.NET. The action that I want to perform on each of the Array values is: Private Function AddQuotes(ByVal value As String) As String Return...
5
9815402440
by: 9815402440 | last post by:
hi i am using acess 2003 as back end of my application. database was fine a few days back. i have a table named Ac_LedgerMaster. i have several tables that are related to this table. now relations...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.