Recent

Author Topic: Adding multiple columns with SQL/ZeosLib/Firebird?  (Read 8611 times)

victorhelsing

  • New Member
  • *
  • Posts: 14
Adding multiple columns with SQL/ZeosLib/Firebird?
« on: September 06, 2009, 06:46:30 am »
I am trying to add multiple columns to a table using SQL in my program.

e.g.  ReadQuery.SQL.Text := "ALTER TABLE Map NEWCOLNAME INTEGER";
       ReadQuery.Open;

If I do it just once, it works.  But if I follow it by another, it fails.  Is there a trick here?  I have tried stacking the statements in multiple lines in the SQL stringlist, but this also fails.

I noticed in reading the documentation for SQLite that you can only add 1 column to SQLite, so perhaps this is a limitation of SQL and not Zeos/Interbase, etc.

Thanks.

(By the way, is there a decent component available to work with SQLite with a Table type component?  I have tried loading down the sqlite3ds/customsqliteds, etc. by Luiz, but these do not have a visual component to edit tablename, fields, etc.)

hy

  • Full Member
  • ***
  • Posts: 221
Re: Adding multiple columns with SQL/ZeosLib/Firebird?
« Reply #1 on: September 06, 2009, 03:12:52 pm »
Don't use
ReadQuery.Open
but
ReadQuery.ExecSQL

instead ... just give it a try - because you are not opening a table but executing a command.
_____
***hy
OS: debian sid(64bit)  [fpc 3.20] Lazarus 2.0.12

tatamata

  • Hero Member
  • *****
  • Posts: 787
    • ZMSQL - SQL enhanced in-memory database
Re: Adding multiple columns with SQL/ZeosLib/Firebird?
« Reply #2 on: September 13, 2009, 03:02:59 pm »
I will assume you are changing SQL text before subesequent query executiion. If so, you must first Close the query, then Clear the SQL property, set new SQL.Text property and finally Open query again.

 

TinyPortal © 2005-2018