Board index » delphi » when to use exception handling?

when to use exception handling?

Hiya

When should i use exception handling when dealing with ado tables and
queries? For example is the code below ok?

with datamodule1.scoresADOTable do
                   begin
                   open;
                   Insert;
                   FieldByName('username').Value := username;
                   FieldByName('date').value:= timedate;
                   Post;
                   end;

An application that has been working perfectly for several months has today
gone barmy and been throwing up errors all day.

Its a program being used by upto 90 users simultaniously, win98, MS Access
2000

Thanks for any help given
Pete

 

Re:when to use exception handling?


My guess is that your database is corrupted. Try repairing the database.
That append all the time with our application when our client insist on
using Access

90 users simultaniously, win98, MS Access 2000, WOW you're pushing you're
luck!!
You should be thinking on using a database server like Interbase, MySql,
MSSQL Server etc
As for your code It seem ok to me althought we never use AdoTable,
as we always work with TADODataSet et TADOQuery with SQL.

Sylvain

Quote
"dmjsky" <dmj...@dmjsky.fsnet.co.uk> wrote in message

news:b0qqkb$9or$1@news7.svr.pol.co.uk...
Quote
> Hiya

> When should i use exception handling when dealing with ado tables and
> queries? For example is the code below ok?

> with datamodule1.scoresADOTable do
>                    begin
>                    open;
>                    Insert;
>                    FieldByName('username').Value := username;
>                    FieldByName('date').value:= timedate;
>                    Post;
>                    end;

> An application that has been working perfectly for several months has
today
> gone barmy and been throwing up errors all day.

> Its a program being used by upto 90 users simultaniously, win98, MS Access
> 2000

> Thanks for any help given
> Pete

Re:when to use exception handling?


Its for a school assessment program and it had been working fine.
Unfortunatly,  as i'm a teacher writting it for myself at school so i dont
have the luxury of specifying what systems i use! I could open the database
fine, but the network was grinding to a halt for some unknown reason. What
is the difference between the components i'm using and the TADO ones?

Thanks
Pete

Quote
"Sylvain Lamothe" <sylva...@groupid.com> wrote in message

news:YJgY9.54632$_N5.1029271@news20.bellglobal.com...
Quote
> My guess is that your database is corrupted. Try repairing the database.
> That append all the time with our application when our client insist on
> using Access

> 90 users simultaniously, win98, MS Access 2000, WOW you're pushing you're
> luck!!
> You should be thinking on using a database server like Interbase, MySql,
> MSSQL Server etc
> As for your code It seem ok to me althought we never use AdoTable,
> as we always work with TADODataSet et TADOQuery with SQL.

> Sylvain

> "dmjsky" <dmj...@dmjsky.fsnet.co.uk> wrote in message
> news:b0qqkb$9or$1@news7.svr.pol.co.uk...
> > Hiya

> > When should i use exception handling when dealing with ado tables and
> > queries? For example is the code below ok?

> > with datamodule1.scoresADOTable do
> >                    begin
> >                    open;
> >                    Insert;
> >                    FieldByName('username').Value := username;
> >                    FieldByName('date').value:= timedate;
> >                    Post;
> >                    end;

> > An application that has been working perfectly for several months has
> today
> > gone barmy and been throwing up errors all day.

> > Its a program being used by upto 90 users simultaniously, win98, MS
Access
> > 2000

> > Thanks for any help given
> > Pete

Re:when to use exception handling?


i) Check if any indexes have been defined on the fields you are modifying.
If so, it would be worth "Compacting / repairing" the database (use MS
Access to do this easily). An exception error would be thrown if the
connection is not open for some reason - the open statement would fail.
ii) Are you using the latest version of MDAC (now 2.7)?
iii) I use the TBetterADODataset component (http://web.orbitel.bg/vassil/)
as it fixes a couple of ADO 'bugs' in the Borland implementation.
HTH
Quote
"dmjsky" <dmj...@dmjsky.fsnet.co.uk> wrote in message

news:b0qqkb$9or$1@news7.svr.pol.co.uk...
Quote
> Hiya

> When should i use exception handling when dealing with ado tables and
> queries? For example is the code below ok?

> with datamodule1.scoresADOTable do
>                    begin
>                    open;
>                    Insert;
>                    FieldByName('username').Value := username;
>                    FieldByName('date').value:= timedate;
>                    Post;
>                    end;

> An application that has been working perfectly for several months has
today
> gone barmy and been throwing up errors all day.

> Its a program being used by upto 90 users simultaniously, win98, MS Access
> 2000

> Thanks for any help given
> Pete

Re:when to use exception handling?


Quote
"pete" <deepthin...@btinternet.com> wrote in message

news:b0saj2$610$1@sparta.btinternet.com...

Quote
> Its for a school assessment program and it had been working fine.
> Unfortunatly,  as i'm a teacher writting it for myself at school so i dont
> have the luxury of specifying what systems i use! I could open the
database
> fine, but the network was grinding to a halt for some unknown reason. What
> is the difference between the components i'm using and the TADO ones?

> Thanks
> Pete

pete
From the code snippet in your post, you seem to be using ADO to access your
db
  >with datamodule1.scoresADOTable do

There surely is some documentation on the net explaining that better then I
can but here

With an Access type db when you work with a Table, the whole table must be
transfered on the client to be manipulated. That generate a lot of traffic
on the network.
Let's say your your app is using 10 tables and 90 users are accessing them
at the same time, that alone could grind any network to a halt, depending of
course on the size of the tables an rows! Maybe that is what is happening.

When using a Db Server such as Oracle, SQLServer, Firebird, MySql etc, you
can work on a set of data (a Dataset or RecordSet) instead of a table.
You ask the server a subset like "SELECT * from Student  WHERE grade = 1".
Only  rows for the students in grade 1 will have to go across the network,
thus minimizing traffic.  This is done usually with a TADODataset

For an update you will use a TADOQuery, in that case only the sql string
will be sent to the server.

Maybe you can install a Open Source Db Server in your school such as MySql
or Firebird, Ask your MIS.

regards
Sylvain

Other Threads