473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Erro running a query if dashes present in the string

Hi all,

I have a table in the DB which holds ISBN book nubers .. which, as you know
have dashes (examlple: 0-98765-8-9).

When I run a query from an ASP page to find the number, it doesn't return
anything:

sISBN = "0-98765-8-9"
OpenSQL(select URL from ISBN_Redirect where ISBN=" & sISBN )

Can you give me a hind of what I am doing wrong?

Thanks so much in advance.

S
Jul 20 '05 #1
1 2101
Satvic (fu**@spammers.com) writes:
I have a table in the DB which holds ISBN book nubers .. which, as you
know have dashes (examlple: 0-98765-8-9).

When I run a query from an ASP page to find the number, it doesn't return
anything:

sISBN = "0-98765-8-9"
OpenSQL(select URL from ISBN_Redirect where ISBN=" & sISBN )

Can you give me a hind of what I am doing wrong?


You must quote the ISBN number:

OpenSQL(select URL from ISBN_Redirect where ISBN='" & sISBN & "'")

Else you are looking for -98782.

Better though, is to use parameterized queries, in which case you don't
have to manipulate quotes yourself.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

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

Similar topics

7
by: Ross Presser | last post by:
OK, I've been researching this problem and can't find a definitive answer yet. The situation is one that seems to have come up a few times to different folks. I am writing an application that...
1
by: PW Herman | last post by:
Does mySQL not like dashes or something? I seem to be getting the following error: "Unknown column 'etrans' in 'where clause'" when I do the following query: SELECT * from expense where...
10
by: juglesh | last post by:
hello, I've put in my time searching, so I'll ask now<G> I need to look at the url, if a variable is present in the query string. so, if my address bar looks like:...
1
by: Jacky11 | last post by:
I want to have a query that removes all dashes between the item code, from field named But I don't want to delete the dashes from the table. See 3 different examples. Panasonic KX-TCA91 Over...
6
by: John Baker | last post by:
HI: I have a situation where I wish to enter a value in an unbound field on a form and then change the same field in each record on the form so that it reflects the value entered. THe form is...
4
by: Lumpierbritches | last post by:
I have a query that pulls information for a report. Sometimes the report is in tact and works wonderful; other times the report gives me a syntax error. The information is only different in one...
5
by: social_engin33r | last post by:
Hello, I've been asked to help someone set up a database. One of the fields in the database is a text field that holds data imported in this format: 11-A-11-11 The users prefer to see the...
18
by: simonmarkjones | last post by:
Hi all, I create a report to act as a receipt to customers. The report displays all the customer payment details and then i print this. This works fine. However, i now want to add some more...
3
by: Wayne | last post by:
I'm trying to automate the export of a query to a text file using code. If I export the query manually I get the exact result that I want i.e. If I select the query then choose File/Export from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.