The Bitman
The Bitman

Reputation: 1329

TADOCommand.execute

When I execute this SQL query:

aC.commandText := 'SELECT [MODEL], [PART], [SECTION], [FOOTPRINT], [NODELIST] FROM BJT';
aDS.resultSet := aC.execute;

it runs successfully. But when I run this one (with a where clause):

aC.commandText := 'SELECT [MODEL], [PART], [SECTION], [FOOTPRINT], [NODELIST] FROM BJT WHERE lower( BJT.MODEL ) LIKE ''m%'';';
aDS.resultSet := aC.execute;

It throws an exception with message : 'Unspecified exception'. I tried it with '*' instead of '%', with/without [] around then MODEL/BJT.MODEL in the where clause, it was the same. What is wrong with it? The brackets are necessaries because it is generated by program for any field names (handling reserved words like SECTION)

Upvotes: 0

Views: 247

Answers (1)

Gustav
Gustav

Reputation: 55816

Try with proper Access syntax:

'SELECT [MODEL], [PART], [SECTION], [FOOTPRINT], [NODELIST] FROM BJT WHERE LCase([MODEL]) LIKE ''m*'';'

Upvotes: 2

Related Questions