Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

BCB database problem

[es] :: C/C++ programiranje :: BCB database problem

[ Pregleda: 2182 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

oxygenne

Član broj: 19728
Poruke: 13
62.162.212.*



Profil

icon BCB database problem27.06.2007. u 12:46 - pre 204 meseci
sta je problem sa sledecim kodom

Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add("select number from calls where number like :test ");
Query1->Params->Items[0]->AsInteger=StrToInt(Edit1->Text);
Query1->Prepare();
Query1->ExecSQL();

ParamByName("test")->AsString=Edit1->Text; Ne radi ni ovo

 
Odgovor na temu

darko_sudarov
ProConto Software doo
Kikinda

Član broj: 89262
Poruke: 136
82.208.201.*



Profil

icon Re: BCB database problem27.06.2007. u 13:44 - pre 204 meseci
Mislim da to like pravi probleme jer ti ne vraca jedinstvene rekorde,to bi po meni bilo ok ali da ti vrati u gbgrid ali u tedit ne moze.
napravi od toga proceduru u bazi i puni parametar iz tedita.

[Ovu poruku je menjao darko_sudarov dana 27.06.2007. u 15:02 GMT+1]
 
Odgovor na temu

X Files
Vladimir Stefanovic
Pozarevac

SuperModerator
Član broj: 15100
Poruke: 4902
*.dynamic.sbb.co.yu.

Jabber: xfiles@elitesecurity.org


+638 Profil

icon Re: BCB database problem27.06.2007. u 15:05 - pre 204 meseci
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]
 
Odgovor na temu

oxygenne

Član broj: 19728
Poruke: 13
62.162.219.*



Profil

icon Re: BCB database problem27.06.2007. u 15:42 - pre 204 meseci
Ok hvala to je bio problem
Note: For SELECT statements, call Open instead of ExecSQL.
Nije bilo problema kod kompajliranje vec kod rezultata nije ga bilo u tabeli
 
Odgovor na temu

[es] :: C/C++ programiranje :: BCB database problem

[ Pregleda: 2182 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.