Board index » delphi » Mystery messages with Delphi 2.0 and MS SQL Server

Mystery messages with Delphi 2.0 and MS SQL Server

Hi! Folks,

I am using D2 alongwith MS SQL 6.5, my project has been on for the past
5 months and in my experience of 5 months i have been able to find
solutions ( not always satisfactory ) to most of my problems in Borland
Newsgroups ( this is where Borland scores over Microsoft ). But there
are a few things for which I have still not found any clues or answers.

Here is a list of them

BDE messages - very simple but difficult to understand

Connection in use by another statement - after this I have to shutdown
my application
and bcos of this my client is screaming.

Operation Not Applicable - This generally happens when I have edited a
Master-Detail relationship (either Master or Detail ) and then posted
them. It works fine the first time. If I make changes again, and try to
commit them I get this simple, cute message

Update Failed - This one is really mystifying, my form was doing great
when suddenly out of the blue comes this message, no changes have been
made to the related tables at the backend and everything is as it is.

To briefly describe my application, it has a total of 263 tables with
records running upto as many as > 100,000 records in certain tables. I
have always worked with Master - Detail relationships and found them to
be good enough though they can be a pain sometimes.

My life would be much more easier if some good samatarian amongst
youlearned people would shed some light on the above mystifying messages
(as I call them )

Regards

Nytil

 

Re:Mystery messages with Delphi 2.0 and MS SQL Server


? Question ?

Are you using TTable and cached updates?

Jim C

Quote
nytil wrote:

> Hi! Folks,

> I am using D2 alongwith MS SQL 6.5, my project has been on for the past
> 5 months and in my experience of 5 months i have been able to find
> solutions ( not always satisfactory ) to most of my problems in Borland
> Newsgroups ( this is where Borland scores over Microsoft ). But there
> are a few things for which I have still not found any clues or answers.

> Here is a list of them

> BDE messages - very simple but difficult to understand

> Connection in use by another statement - after this I have to shutdown
> my application
> and bcos of this my client is screaming.

> Operation Not Applicable - This generally happens when I have edited a
> Master-Detail relationship (either Master or Detail ) and then posted
> them. It works fine the first time. If I make changes again, and try to
> commit them I get this simple, cute message

> Update Failed - This one is really mystifying, my form was doing great
> when suddenly out of the blue comes this message, no changes have been
> made to the related tables at the backend and everything is as it is.

> To briefly describe my application, it has a total of 263 tables with
> records running upto as many as > 100,000 records in certain tables. I
> have always worked with Master - Detail relationships and found them to
> be good enough though they can be a pain sometimes.

> My life would be much more easier if some good samatarian amongst
> youlearned people would shed some light on the above mystifying messages
> (as I call them )

> Regards

> Nytil

Re:Mystery messages with Delphi 2.0 and MS SQL Server


Quote
> Connection in use by another statement - after this I have to shutdown
> my application
> and bcos of this my client is screaming.

I used to get this when I was using Delphi/SQL-Server/ODBC.  The
solution is to have multiple Database components for your tables and
queries, so that the connections are not used up.  Alternatively, use
SQL-Links.

Quote
> Operation Not Applicable - This generally happens when I have edited a
> Master-Detail relationship (either Master or Detail ) and then posted
> them. It works fine the first time. If I make changes again, and try to
> commit them I get this simple, cute message

You should do a Refresh (if its a ttable) or re-read the record (if its
a tquery) before re-editing.

Personally, I think you should drop the ODBC interface and switch to
SQL-Links (if you can afford it).

Oliver

Re:Mystery messages with Delphi 2.0 and MS SQL Server


Your Name,

To be very precise these messages keep on poping up frequently when i am
using TQueries at both master and detail levels and the detail is a join
of 2 or more tables, i am using TUpdateSQL at both the master and detail
levels and the Requst Live of both the master and detail has been set to
False, with CacheUpdates set to True. Any other clarifications required
please do not hesitate and thanx.

Nytil

Re:Mystery messages with Delphi 2.0 and MS SQL Server


Oliver Towns,

I am already using SQL Links, but I will try out the solutions you
suggested.

Thanx a ton

Re:Mystery messages with Delphi 2.0 and MS SQL Server


nytil heeft geschreven in bericht <34DC63CD.6...@hotmail.com>...

Quote
>Hi! Folks,

>I am using D2 alongwith MS SQL 6.5, my project has been on for the past
>5 months and in my experience of 5 months i have been able to find
>solutions ( not always satisfactory ) to most of my problems in Borland
>Newsgroups ( this is where Borland scores over Microsoft ). But there
>are a few things for which I have still not found any clues or answers.

>Here is a list of them

>BDE messages - very simple but difficult to understand

>Connection in use by another statement - after this I have to shutdown
>my application
>and bcos of this my client is screaming.

>Operation Not Applicable - This generally happens when I have edited a
>Master-Detail relationship (either Master or Detail ) and then posted
>them. It works fine the first time. If I make changes again, and try to
>commit them I get this simple, cute message

>Update Failed - This one is really mystifying, my form was doing great
>when suddenly out of the blue comes this message, no changes have been
>made to the related tables at the backend and everything is as it is.

>To briefly describe my application, it has a total of 263 tables with
>records running upto as many as > 100,000 records in certain tables. I
>have always worked with Master - Detail relationships and found them to
>be good enough though they can be a pain sometimes.

>My life would be much more easier if some good samatarian amongst
>youlearned people would shed some light on the above mystifying messages
>(as I call them )

>Regards

>Nytil

Connection in use : sometimes this can besolved by using First, Last
command.
                                   This is true when requesting the server
date/time using a query.

Last two problems :
I experienced severe problems under the following circustances :
- MS Sql server version 6.5 service pack 4.
- Delphi 2.0 thru 3.02
- BDE version 3.5 thru 4.51.
- Using Tquery objects cached updates =true, request live = false, applying
data to the SQL server
   using Update objects.

If you :
- create several new records within a query without refreshing the
uery( each record seperatly
  applied to the server(with succes)).
- create a new record and apply to server (with succes).
- modify the last record so that the server will generated a constraint
error.
- apply the changes to the server ( which result in an error) (don't refresh
the query).
- if you now modify the same record so that it is correct
- apply the changes to the server(this will not work).
  it seems that Delphi is now trying to insert all new records to the
server. The TQuery.UpdateStatus will be usInserted for all newly created
records. Within the OnUpdate invent handler the updatekind will be
usInserted and Delphi lost track of the oldvalues( they will be null).

If you do the above within a master/ detail relation you will have an
"Operation not applicable" error
after a call to TQuery.Cancel and a TDataBase.CancelUpdates([...,...]) and
trying to edit another record.
The above is reported to Borland. No answers yet.
From several sources I know that the probleem should be known by Borland for
a long time.
(about a year!)

Update Failed error: This error is generated within the code of TUpdateSql
component.
                                    In general this error will be generated
if the server returns 0 rows affected.
                                    E.g. you make a call to
TUpdateSql.ApplyUpdates(updatekind)  and the
                                    sql statement processed 0 rows on the
server. The sql statement itself is
                                    correct.
                                    Beware : The error is presented to the
user before the transaction is rolled
                                    back. As long as the message is on the
screen there is an active transaction.

Kind regards,
  Wim Entrop
  E...@BS.IMTECH.NL

Other Threads