Citat:
sta je problem sa sledecim kodom
To bi ti trebao da kazes (tj, sta ne valjda: kompajliranje, dodeljivanje parametra, rezultat, nesto sasvim drugo...) ;)
Za početak, pročitaj u Help-u kada se koristi ExecSQL() a kada Open() za izvrsavanje pripremljenog SQL upita...
Citat:
Executes the SQL statement for the query.
void __fastcall ExecSQL(void);
Description
Call ExecSQL to execute the SQL statement currently assigned to the SQL property. Use ExecSQL to execute queries that do not return a cursor to data (such as INSERT, UPDATE, DELETE, and CREATE TABLE).
Note: For SELECT statements, call Open instead of ExecSQL.
ExecSQL prepares the statement in SQL property for execution if it has not already been prepared. To speed performance, an application should ordinarily call Prepare before calling ExecSQL for the first time.
1. Za SELECT treba Open() a ne ExecSQL().
2. LIKE ključna reč traži i znake za procenat ispred i/ili iza vrednosti (inače se ponaša kao znak jednakosti)
3. LIKE taži i znake jednostrukog navoda ispred i iza vrednosti
SQL bi trebao da izgleda onda ovako /netestirano/
select number from calls where number LIKE '1'
select number from calls where number LIKE '1%'
select number from calls where number LIKE '%1'
select number from calls where number LIKE '%1%'
itd...
P.S.
Necu da kvarim ispravan stil dodavanja parametara SQL recenici (koji koristis), ali ne zaboravi da moze i bez parametara:
AnsiString Upit = "select number from calls where number LIKE '%" + Edit1->Text + "%'";
Query1->SQL->Add( Upit );
[Ovu poruku je menjao X Files dana 28.06.2007. u 09:14 GMT+1]