Insert error with Adocommand

Asked

Viewed 315 times

0

In Delphi XE4, SQL Server 12, connected by ADOConnect.

ADOCommand1.commandText being 'insert into tabela (a,b,c) (1,1,1)'

It works as expected if a record already exists. But if it is the first record the message appears:

"An empty line cannot be inserted, the line must have at least one defined column value"

Despite the message, the record is included, checked by a later query.

  • 2

    Details are missing but I believe that in the second INSERT no values are passed to the object.

  • 2

    I think the correct syntax would be INSERT INTO TABELA (a, b, c) **VALUES** (1, 1, 1), nay?

2 answers

1

The Syntax is incorrect

Would that be

SQL.ADD('insert into tabela (a,b,c) VALUES (1,1,1)');

-2

The reserved word INTO is not missing?

Insert into table (a,b,c) INTO (1,1,1)

  • 1

    the correct syntax is INSERT **INTO** tabela (campo1, campo2) **VALUES** (valora, valorb)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.