Subject Fw: [IBO] qrIBOT???
Author dkLists
Jason -

I found a way to obtain the field names at runtime using
SchemaCache.GetTableNames(param1, param2), so the task is completed.

I have seen the error that this thread originally referenced before. I could
not discern anything unusual that I was doing that could cause that error.

Any ideas?

thanks.

David Keith
----- Original Message -----
From: "dkLists" <dklists@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, November 29, 2001 8:55 AM
Subject: Re: [IBO] qrIBOT???


> Jason -
>
> First of all, setting AutoFetchAll doesn't make the error go away.
> Second, I should probably tell you why I'm using an TIBOTable in case you
> want to recommend a better approach: I simply want to obtain the field
names
> for a table whose name is obtained at runtime. I've created a simple
'batch
> mover' to move some data from pdox tables to IB tables. I build the list
of
> pdox and IB tables at runtime, select the source and dest tables, and then
> run the following code:
>
> // ibot is the TIBOTable component...
> ibot.TableName := cbSource.Text;
> ibot.IB_Connection := listman; // listman is the IB_Connection
component
> ibot.Open;
>
> // tblList is a TTable connected via BDE to a pdox table
> // all source and dest tables have identical structures, with
> // the exception of some column naming differences
> for i := 0 to tblList.FieldCount - 1 do
> begin
> if i = tblList.FieldCount - 1 then
> begin
> s := s + ibot.Fields[i].FieldName;
> s2 := s2 + ':VAL' + intToStr(i);
> end
> else
> begin
> s := s + ibot.Fields[i].FieldName + ', ';
> s2 := s2 + ':VAL' + intToStr(i) + ', ';
> end;
> end;
> ibot.Close;
>
> // dsq is a DSQL component
> dsq.SQL.Text := 'INSERT INTO ' + cbDest.Text + ' ('
> + s + ') ' + 'VALUES (' + s2 + ');';
> showMessage(dsq.sql.text);
> sb.Panels[0].Text := 'Records Processed:';
> dsq.Prepare;
> tblList.First;
> i := 0;
> while not tblList.Eof do
> begin
> i := i + 1;
> application.ProcessMessages;
> for n := 0 to tblList.FieldCount - 1 do
> begin
> dsq.ParamByName('VAL'+intToStr(n)).AsString :=
> tblList.Fields[n].AsString;
> end;
> try
> dsq.ExecSQL;
> except
> continue;
> end;
> sb.Panels[1].Text := intToStr(i);
> tblList.Next;
> end;
> dsq.Unprepare;
> tblList.Close;
>
> So the table's create statement varies based on which table is selected. I
> get the error whether the table selected has one column which is the
primary
> key, or 15 columns with multiple keys. Incidentally, Primary Keys and
> Indexes, and required fields are the only constraints that I'm using with
> the current database.
>
> Thanks again.
>
> David Keith
>
>
> > Does setting AutoFetchAll to true make the error go away?
> > If so, what is the table ordered by?
> > Please show me the CREATE TABLE statement for your table, including keys
> and
> > constraints.
>
>
>
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>