Re: ADOQuery Command Text does not return a result set
- From: Bob Swart <Bob@xxxxxxxxxx>
- Date: Fri, 23 May 2008 14:27:56 +0200
Hi Leposava,
I have this code
ADOQ2.Active:=False;
ADOQ2.Close;
ADOQ2.SQL.Clear;
sqlFill := '';
sqlFill := ('UPDATE Izpisi ');
sqlFill := sqlFill+(' Set DATA = '''+AdoTable1.FieldByName('data').AsString+'''' );
sqlFill := sqlFill+('WHERE IZPISTIP = 1');
ADOQ2.SQL.Add(sqlFill);
ADOQ2.ExecSQL;
This will execute the query, once, and not expecting a result set.
ADOQ2.Active:=True;
This will re-execute the query again, expecting a result set.
You should not set Active to True (or False again) when using with UPDATE (or INSERT/DElETE) commands that to not return result sets. ExecSQL is enough, although you can also use the Execute method of the TADOConnection component (without the need of a TADOQuery component).
Groetjes,
Bob Swart
--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
Delphi Win32 & .NET books on Lulu.com: http://stores.lulu.com/drbob42
Personal courseware + e-mail support http://www.ebob42.com/courseware
Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml
.
- Follow-Ups:
- Re: ADOQuery Command Text does not return a result set
- From: Leposava Knez
- Re: ADOQuery Command Text does not return a result set
- References:
- ADOQuery Command Text does not return a result set
- From: Leposava Knez
- ADOQuery Command Text does not return a result set
- Prev by Date: ADOQuery Command Text does not return a result set
- Next by Date: ADO, ShortDateFormat and Terminal Services/Citrix
- Previous by thread: ADOQuery Command Text does not return a result set
- Next by thread: Re: ADOQuery Command Text does not return a result set
- Index(es):
Relevant Pages
|
|