Subject Re: open datasets for inserting taking long.
Author Marco Menardi <mmenaz@lycosmail.com>
Well, as far as I remember, you can insert data in a closed dataset,
so you can simply call ".insert" and let the user fill the mask, then
he has to press "post" and then "insert" again (or just insert? I
don't remember if it does an automatically post, but it should be).
But I do this way:
I "open" all the datasets in SearchMode (.Search) with SchemaColor
enabled. This way NO DATA is transferred from the engine to the
client, since search is only a client (IBO) state.
This way my customers can search data, or (pressing insert) add new
one. After each post the dataset returns automatically to search mode.
I've found this be very effective and powerful.
If you mask is ONLY for adding data, you can start the above way, and
re-issue an Insert in some final event (in the AfterPost of the
dataset? StateChange (when becomes search or browse) of the
datasource? You have to experiment).

If you have a query like SELECT * FROM CUSTOMERS, when you do:
qryCustomers.Open;
qryCustomers.Insert;
in the .Open you are asking the engine "give me ALL the rows that
result from the above query, and start send them to the client".
So it could take long...
In addition if you, like I do, set GetServerDefaults to true, the
first insert brings all the database default metadata to the client,
where is cached for future use. The performance of this has greatly
improved in recent versions (in previous the default was retrieved for
each dataset, now it's retrieved globally only the first time and
cached), but it certainly slows down the first ".insert".

regards
Marco Menardi


--- In IBObjects@yahoogroups.com, "wayne" <waynef@w...> wrote:
> I have about 5 datasets ,, I have to open when a form becomes visual,
>
> I want to open the datasets for inserting Data.
>
> I have noticed that when I open the DataSets it takes rather long since
> the first Record of each dataset gets displayed for a brief second
or two.
>
> My Question is , how can I put the datasets into insert mode without
data
> running up and
> down the wire ,, or at least minimal ?
>
>
> Or should I keep the DataSets open throuhout my apllication ?
>
> If so here is my initial thought ::
> If so How Does one acomplish this in an MDI application.
> " Have one central DataModule for Datasets" and
> "a TRanSaction pertaining to each Form instance".