Link to home
Start Free TrialLog in
Avatar of keynes
keynes

asked on

How to use update(SQL) statement in delphi?

I want to use a SQL statement like this:
'update fixasset set assetstatus='0' where assetstatus='F' '
I want to write it in delphi program. I don't want to use store procedure. I write it in TQuery but it not work. Can you tell the details of how to do so???
Avatar of rwilson032697
rwilson032697

You need to use the ExecSQL method...

Perhaps you could post you code that does no work?

Cheers,

Raymond.

What is the query.CacheUpdates?
Avatar of simonet
When using that kind of statement in a TQuery component, you must call it by issuing:

Query1.ExecSQL;

It will not work if you call "Query1.Open" or "Query1.Active := true".

Are you getting any error messages?

Alex
Avatar of keynes

ASKER

I use execsql.
But it returned a error message
'Table is read-only.'
hi keynes,

execsql is the way, after fired you can get with the property rowsaffected how much records are updated.

>'Table is read-only.'
what database do you use?

meikl
did update priv of Table fixasset grant ti user?
ASKER CERTIFIED SOLUTION
Avatar of RBertora
RBertora
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of keynes

ASKER

Thanks everybody.
Could you tell us what you needed to do to fix it?

Seems to me RBertora's answer did not contribute to the information already supplied by other experts...

Cheers,

Raymond.
Ditto.

keynes, why did you accept RBertora's answer since all he/she said had already been said by other experts?

Alex
Keynes, did you read me question?