Board index » delphi » Problems with IBX 5.02

Problems with IBX 5.02

Hello, community.

We are working D5, IB6.01 and IBX.

The following code runs without problems with IBX 4.3, but with IBX 5.02,
the database table is successfully created, but when attemp to open the
IBTable1 generates this error "Table TABLAEJEMPLO not exists". WHY?????

We need to solve this problem.

  IBTABLE1.Database := IBDataBase1;
  IBQUERY1.Database := IBDataBase1;
  IBDataBase1.Open;

  IBQUERY1.SQL.Clear;
  IBQUERY1.SQL.Add( 'CREATE TABLE TABLAEJEMPLO (' );
  IBQUERY1.SQL.Add( 'Codigo_Concepto SmallInt not null,' );
  IBQUERY1.SQL.Add( 'Codigo_Empresa SmallInt not null,' );
  IBQUERY1.SQL.Add( ' primary key (Codigo_Concepto,Codigo_Empresa))' );
  IBQUERY1.ExecSQL;

  IBTABLE1.TABLENAME := 'TABLAEJEMPLO'
  IBTABLE1.Open;                   // the problem with IBX5.02 is here.
  IBTABLE1.Append;
  IBTABLE1.FieldValues['Codigo_Concepto ] := 1;
  IBTABLE1.FieldValues['Codigo_Empresa '] := 1;
  IBTABLE1.Post;
  IBTABLE1.Close;
  IBDataBase1.Close;

 

Re:Problems with IBX 5.02


Try committing the transaction after you create the table.  You were taking
advantage of a major IBTransaction logic bug in your old code that is now
corrected.  This code worked just fine for me.

  IBTABLE1.Database := IBDataBase1;
  IBQUERY1.Database := IBDataBase1;
  IBDataBase1.Open;

  IBQUERY1.SQL.Clear;
  IBQUERY1.SQL.Add( 'CREATE TABLE TABLAEJEMPLO (' );
  IBQUERY1.SQL.Add( 'Codigo_Concepto SmallInt not null,' );
  IBQUERY1.SQL.Add( 'Codigo_Empresa SmallInt not null,' );
  IBQUERY1.SQL.Add( ' primary key (Codigo_Concepto,Codigo_Empresa))' );
  IBQUERY1.ExecSQL;
  IBTransaction1.Commit;

  IBTABLE1.TABLENAME := 'TABLAEJEMPLO';
  IBTABLE1.Open;                   // the problem with IBX5.02 is here.
  IBTABLE1.Append;
  IBTABLE1.FieldValues['Codigo_Concepto' ] := 1;
  IBTABLE1.FieldValues['Codigo_Empresa'] := 1;
  IBTABLE1.Post;
  IBTABLE1.Close;
  IBDataBase1.Close;

Quote
Ramiro Arias Cantos wrote:

> Hello, community.

> We are working D5, IB6.01 and IBX.

> The following code runs without problems with IBX 4.3, but with IBX 5.02,
> the database table is successfully created, but when attemp to open the
> IBTable1 generates this error "Table TABLAEJEMPLO not exists". WHY?????

> We need to solve this problem.

>   IBTABLE1.Database := IBDataBase1;
>   IBQUERY1.Database := IBDataBase1;
>   IBDataBase1.Open;

>   IBQUERY1.SQL.Clear;
>   IBQUERY1.SQL.Add( 'CREATE TABLE TABLAEJEMPLO (' );
>   IBQUERY1.SQL.Add( 'Codigo_Concepto SmallInt not null,' );
>   IBQUERY1.SQL.Add( 'Codigo_Empresa SmallInt not null,' );
>   IBQUERY1.SQL.Add( ' primary key (Codigo_Concepto,Codigo_Empresa))' );
>   IBQUERY1.ExecSQL;

>   IBTABLE1.TABLENAME := 'TABLAEJEMPLO'
>   IBTABLE1.Open;                   // the problem with IBX5.02 is here.
>   IBTABLE1.Append;
>   IBTABLE1.FieldValues['Codigo_Concepto ] := 1;
>   IBTABLE1.FieldValues['Codigo_Empresa '] := 1;
>   IBTABLE1.Post;
>   IBTABLE1.Close;
>   IBDataBase1.Close;

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act
alone, solve equations, analyze a new problem, pitch manure, program a computer,
cook a tasty meal, fight efficiently, die gallantly.  Specialization is for
insects.   (RAH)

Other Threads