Subject | Re: [IBO] IBOQuery - Query Editor |
---|---|
Author | Helen Borrie |
Post date | 2006-03-08T05:19:50Z |
At 03:16 PM 8/03/2006, you wrote:
with a set retrieved from a database query. Talking about the VCL
and the TIBO* data access components, the database query is realised
in a TDataset descendant, e.g. TIBOQuery. The TDataset object is
linked to a TDatasource and the TDatasource is linked to the
data-bound control.
The TDataset has public methods that you call in your code (or
through another control, e.g. a TDBNavigator) for the three DML
methods, Insert, Update (the method is Edit) and Delete.
Calling Insert, Edit or Delete puts the dataset into a "state" where
writes to the database will occur if the contents of the grid are
posted to the database (via another method, named Post). Because all
IB/Fb work has to happen in a transaction, the posted changes will
become final when the Commit method of the transaction is called.
the new.ID value before deciding whether to pull a new value from the
generator.
In IBO, make an entry in GeneratorLinks to tell IBO that the PK value
is to be got from the generator, viz.
In the dataset property: ID=MyGenerator
or, you can set it globally on the TIBODatabase's GeneratorLinks:
MyTable.ID=MyGenerator
Delphi and OO languages in this list! :-) At some point real soon
you'll need to come to an understanding of both, to make headway with
database application programming.
Helen
>--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:Hmmm. TDBGrid is a data-bound control. That means it only works
> > >3. In the InsertSQL window I want to pass the grid row values back
> > >into the database for an insert. How do I reference the new grid
> > >values to be inserted?
> >
> > USE PARAMETERS !!!!!!!!!!!!!
> >
> >
> > >insert into PROJ (remark, created, createdby, lockd, lockdby)
> > > values (:remark, :created, :createdby, :lockd, :lockdby)
> >
> > Of course, you'd better have a key in there somewhere, too!!
>
>
>I have examined the Tech Info Sheets and purchased the Getting Started
>Guide. I can't seem to find anywhere (not even in Delphi) any code
>that indicates how to get the values from a new row in a Tdbgrid into
> the database.
with a set retrieved from a database query. Talking about the VCL
and the TIBO* data access components, the database query is realised
in a TDataset descendant, e.g. TIBOQuery. The TDataset object is
linked to a TDatasource and the TDatasource is linked to the
data-bound control.
The TDataset has public methods that you call in your code (or
through another control, e.g. a TDBNavigator) for the three DML
methods, Insert, Update (the method is Edit) and Delete.
Calling Insert, Edit or Delete puts the dataset into a "state" where
writes to the database will occur if the contents of the grid are
posted to the database (via another method, named Post). Because all
IB/Fb work has to happen in a transaction, the posted changes will
become final when the Commit method of the transaction is called.
>Also I have a primary key field called "ID" which has a before insertThe best way to handle this is to write a "safe" trigger, that tests
>generator trigger to create the next ID. What SQL code should I use to
>construct this update SQL if I am using TIBOQuery & TIBODatabase?
the new.ID value before deciding whether to pull a new value from the
generator.
In IBO, make an entry in GeneratorLinks to tell IBO that the PK value
is to be got from the generator, viz.
In the dataset property: ID=MyGenerator
or, you can set it globally on the TIBODatabase's GeneratorLinks:
MyTable.ID=MyGenerator
>Thanks for your help. I'm sure once I can get started with this it'llLet's hope. It's pretty uncommon to find complete newbies at both
>go a lot easier.
Delphi and OO languages in this list! :-) At some point real soon
you'll need to come to an understanding of both, to make headway with
database application programming.
Helen