Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BDE + SQL Server = "Another user changed the record?!?!?"

173 views
Skip to first unread message

Joan Ortanobas

unread,
Jan 8, 2004, 9:45:24 AM1/8/04
to
Hi there,

I have coded a simple application using Delphi 5 + BDE 5.01 + Local
Interbase.

Now I'm trying to get it working against SQL Server 2000.

The problem is that when calling TTable.Edit + TTable.Post I get the error
"Couldn't perform the edit because another user changed the record"... being
the only user connected!

Trying to isolate the problem, I have created a new aplication with a
TDatabase, TTable, two TDBEdits and one TDBNavigator to see it at least it
works, but surprisingly I get the same error... without having written any
line of code!

I know that BDE is not the best choice, but I have to use it... so... any
idea about how to get it working?

TIA

Joan Ortanobas

Kevin Frevert

unread,
Jan 8, 2004, 9:57:22 AM1/8/04
to
"Joan Ortanobas" <jorta...@btgsa.com> wrote in message
news:3ffd...@newsgroups.borland.com...
> Hi there,

> I know that BDE is not the best choice, but I have to use it... so... any
> idea about how to get it working?

And TTables aren't the best choice against a set-based RDBMS
http://bdn.borland.com/article/0,1410,28160,00.html

and (isues with the BDE/DBLib and MSSQL 7/2000)...
http://community.borland.com/article/0,1410,28688,00.html
http://community.borland.com/article/0,1410,10359,00.html
http://community.borland.com/article/0,1410,19694,00.html
http://support.microsoft.com/default.aspx?scid=kb;en-us;260817

Good luck,
krf


dennis_passmore

unread,
Jan 9, 2004, 5:39:47 PM1/9/04
to
Make sure you are not using a Datetime field as a keyfield

Dennis Passmore
Ultimate Software, Inc.

Trevor Toms

unread,
Jan 14, 2004, 10:22:00 AM1/14/04
to
In article <3ffd...@newsgroups.borland.com>, jorta...@btgsa.com (Joan
Ortanobas) wrote:

> Hi there,
>
> I have coded a simple application using Delphi 5 + BDE 5.01 + Local
> Interbase.
>
> Now I'm trying to get it working against SQL Server 2000.
>
> The problem is that when calling TTable.Edit + TTable.Post I get the
> error
> "Couldn't perform the edit because another user changed the record"...
> being
> the only user connected!
>

<snip>

This is often caused by the use of floating point fields used in your
tables.

In order to ensure that the row being edited hasn't changed behind the
scenes, during the "post" routine the BDE generates SQL like:
SELECT * FROM MYTABLE WHERE FIELD1=xx,FIELD2=yy,....FIELD99=zz
This is to check that the original row still exists.

Unfortunately, floating point fields can often not be represented
accurately by decimal values (e.g. 1/3) and so the code becomes:
SELECT * FROM MYTABLE WHERE FIELD1=0.33333333,FIELD2=yy

Here, you can see that the row never returns anything, hence the BDE
thinks that another user must have changed something.

You have only a few options if this is the case.
Option 1, you can change the dataset property UpdateMode to "WhereKeyOnly"
rather than "WhereAll". This might just work for you, but often doesn't
make any difference (the Borland class heirarchy for datasets is flawed).

Option 2, scrap TTables and rewrite using TQueries. This lets you take
more control over how & which rows are being edited.

Hope this helps,
Trevor

0 new messages