#1 2011-01-20 17:52:42

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Simple query

Is there a way to call a simple query? I have a table with some fields (for eaxmple "Order", "Name", "Type", ...), I need change all value of "Type" field to "1" when "Order" value is equal "0".

So I need only change some value on database and as result to know if the operation is successful.

I have check on source and I have find only 2 type of Update function but I cannot use a string as query with them.

Is there a way?

Offline

#2 2011-01-20 17:55:44

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Simple query

I think I have found the solution. I need use "EngineExecute" function, right?

Offline

#3 2011-01-20 18:15:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Simple query

For such queries, it's indeed much more simple to write a SQL statement.

Then use EngineExecute:

  Client.EngineExecute('UPDATE tablename SET Type=1 WHERE Order=0');

or with a prepared statement (if your numerical values may vary):

  Client.EngineExecuteFmt(
    'UPDATE % SET Type=:(%): WHERE Order=:(%):;',[Table.SQLTableName,1,0]);

Offline

Board footer

Powered by FluxBB