Subject | Re: [IBO] TIBOQuery + TClientDataSet = EDatabaseError |
---|---|
Author | kokok_kokok |
Post date | 2011-11-22T15:13:56Z |
I have detailed the process from zero:
1) Create a new database suing Firebird 2.0 or 2.5:
CREATE TABLE ORDERS (
ORDERID INTEGER NOT NULL,
NAME VARCHAR(10)
);
ALTER TABLE ORDERS ADD CONSTRAINT PK_ORDERS PRIMARY KEY (ORDERID);
2) Create a empty project in Builder C++ (or Delphi). In a form, insert one TIBODatabase, TDataSetProvider, one TClientDataSet, and
one TIBOQuery.
3) Enter the following properties of IBODatabase1:
Password
Path
User
Then put Active property to true.
4) Add a button and add the following source in the click event handler:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
DataSetProvider1->DataSet=IBOQuery1;
ClientDataSet1->SetProvider(DataSetProvider1);
IBOQuery1->SQL->Text="SELECT COUNT(*) AS COUNTER FROM ORDERS";
ClientDataSet1->Open();
}
5) Run the project and click the button.
It generates a "EDatabaseError" exception, with "Field OrderId not found". Note that OrderId is not in the SQL statement.
How can I avoid it?
Thank you
1) Create a new database suing Firebird 2.0 or 2.5:
CREATE TABLE ORDERS (
ORDERID INTEGER NOT NULL,
NAME VARCHAR(10)
);
ALTER TABLE ORDERS ADD CONSTRAINT PK_ORDERS PRIMARY KEY (ORDERID);
2) Create a empty project in Builder C++ (or Delphi). In a form, insert one TIBODatabase, TDataSetProvider, one TClientDataSet, and
one TIBOQuery.
3) Enter the following properties of IBODatabase1:
Password
Path
User
Then put Active property to true.
4) Add a button and add the following source in the click event handler:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
DataSetProvider1->DataSet=IBOQuery1;
ClientDataSet1->SetProvider(DataSetProvider1);
IBOQuery1->SQL->Text="SELECT COUNT(*) AS COUNTER FROM ORDERS";
ClientDataSet1->Open();
}
5) Run the project and click the button.
It generates a "EDatabaseError" exception, with "Field OrderId not found". Note that OrderId is not in the SQL statement.
How can I avoid it?
Thank you
--- In IBObjects@yahoogroups.com, "Support List" <supportlist@...> wrote:
>
> > In a form, insert one TIBODatabase, TDataSetProvider, one TClientDataSet,
> > and one TIBOQuery.
> >
> > Enter the properties of IBODatabase1 and tie the IBOQuery1 and
> > IBODatabase1.
> >
> > Then, in the source:
> > DataSetProvider1->DataSet=IBOQuery1;
> > ClientDataSet1->SetProvider(DataSetProvider1);
> > IBOQuery1->SQL->Text="SELECT COUNT(*) AS RECORDS FROM ORDERD";
> > ClientDataSet1->Open();
> >
> > It generates a "EDatabaseError" exception, with "Field OrderId not found".
>
> Because I don't have the database, or even the DDL to generate it, I was
> unable to work on this issue. Please provide a working sample app or
> complete instructions so that I can generate it.
>
> Thanks,
> Jason
> www.ibobjects.com
>