Cant use hyphen in SQL!!! 
Author Message
 Cant use hyphen in SQL!!!

When I build a query in Delphi, (which is executing on a Sybase database) I
can't include a hyphen in the text data!  Can anyone tell me how?  I'm
doing something like this.

query.SQL.Add('update table set name = "' + editboxName.Text + '" where
id=6");

and the edit box referred to has something like:  Joe's Garage     or
whatever, with a hyphen.

I get a database error every time.  If I take out the hyphen, it works
fine.  If I use a function to
add a second hyphen, it shows up with 2!  Can anyone help me please?  You



Fri, 08 Oct 1999 03:00:00 GMT  
 Cant use hyphen in SQL!!!

Hi Joe

I don't know about Sybase, but with Interbase you can enclose strings
either in single or double quotes. e.g.

UPDATE table SET NAME = '14" Monitor'
UPDATE table SET NAME = "Joe's Garage"

When you need to do something like Joe's 14" Monitor, you can do it
like this:

UPDATE table SET NAME = "Joe's " || '14" Monitor'

HTH

Klaus


Quote:
>When I build a query in Delphi, (which is executing on a Sybase database) I
>can't include a hyphen in the text data!  Can anyone tell me how?  I'm
>doing something like this.

>query.SQL.Add('update table set name = "' + editboxName.Text + '" where
>id=6");

>and the edit box referred to has something like:  Joe's Garage     or
>whatever, with a hyphen.

>I get a database error every time.  If I take out the hyphen, it works
>fine.  If I use a function to
>add a second hyphen, it shows up with 2!  Can anyone help me please?  You




Mon, 11 Oct 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Whay cant you run two Programs using BDE?

2. Cant't do it in Local SQL!

3. Hyphens in a DBEdit / DBMemo ?????

4. A Hyphen by any other name

5. Using LOCAL-SQL or Transact-SQL with SQL-server and BDE

6. Using wildcards in Delphi SQL (ANSI 92-SQL) ?

7. Converting VB app to D2, uses SQL 6.0 and SQL 6.5

8. Delphi 3 cant (won't?) DELETE records

9. Cant loop through database???

10. Turbo Debugger - Cant load tdwin.dll

11. Delphi question (cant get all to load)

12. Cant edit or insert

 

 
Powered by phpBB® Forum Software