Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Выборка по столбцу(Interbase) [D7, XP]


Страницы:   1 2 3

Гэби ©   (2008-09-04 12:51:00) 

Как осуществить выборку по определенному столбцу если данные в этом столбце имеют тип String?
По типу Integer делаю так:
IBQuery1.SQL.Add('SELECT * FROM STATION WHERE STATIONP = ' + edit9.Text  + '');
заранее спс


Правильный$Вася   (2008-09-04 13:11:00) [41]


> stas ©   (04.09.08 13:09) [6]

еще один любитель грабель
ты д'Артаньяна туда введи
я уж не говорю по sql injection


Правильный$Вася   (2008-09-04 13:09:00) [42]


> b z   (04.09.08 13:06) [5]

солидарен
ужасный пример для неиспорченного ума, причем от ума продвинутого, что вообще неожиданно


stas   (2008-09-04 13:09:00) [43]

IBQuery1.SQL.Add('SELECT * FROM STATION WHERE STATIONP = ' + #39+edit9.Text+#39  + '');


b z   (2008-09-04 13:06:00) [44]


> Как-то так...
"Расстрелять из пулемёта за такое." (c) ;)


Ega23   (2008-09-04 13:02:00) [45]


> Мужык пасиба! Ты настоящий друг!


пасиба - не булькает.  :)


> З.Ы. Кстати, почему так много '  ?


A character string, also called a string literal or string constant, consists of a quoted string, a control string, or a combination of quoted and control strings. Separators can occur only within quoted strings.

A quoted string is a sequence of up to 255 characters from the extended ASCII character set, written on one line and enclosed by apostrophes. A quoted string with nothing between the apostrophes is a null string. Two sequential apostrophes in a quoted string denote a single character, namely an apostrophe. For example,

'BORLAND'           { BORLAND }
'You''ll see'       { You'll see }
''''                { ' }
''                  { null string }
' '                 { a space }

A control string is a sequence of one or more control characters, each of which consists of the # symbol followed by an unsigned integer constant from 0 to 255 (decimal or hexadecimal) and denotes the corresponding ASCII character. The control string

#89#111#117

is equivalent to the quoted string

'You'

You can combine quoted strings with control strings to form larger character strings. For example, you could use

'Line 1'#13#10'Line 2'

to put a carriage-return-line-feed between "Line 1" and "Line 2". However, you cannot concatenate two quoted strings in this way, since a pair of sequential apostrophes is interpreted as a single character. (To concatenate quoted strings, use the + operator or simply combine them into a single quoted string.)

A character string's length is the number of characters in the string. A character string of any length is compatible with any string type and with the PChar type. A character string of length 1 is compatible with any character type, and, when extended syntax is enabled ({$X+}), a nonempty character string of length n is compatible with zero-based arrays and packed arrays of n characters. For more information about string types, see String types.


Правильный$Вася   (2008-09-04 13:00:00) [46]

использовать параметры
IBQuery1.SQL.Text:='SELECT * FROM STATION WHERE STATIONP = :1';
IBQuery1.Params[0].AsString:=edit9.Text;


Гэби   (2008-09-04 12:59:00) [47]

Мужык пасиба! Ты настоящий друг!
З.Ы. Кстати, почему так много '  ?


Ega23   (2008-09-04 12:53:00) [48]

IBQuery1.SQL.Add('SELECT * FROM STATION WHERE STATIONP = ''' + edit9.Text  + '''');

Как-то так...


Страницы:   1 2 3

Наверх

Титульная страница Поиск, карта сайта Написать письмо