Subject Re: [IBO] qrIBOT???
Author dkLists
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.