Board index » delphi » Deleting Records -- Please Help

Deleting Records -- Please Help

I have a application that has a TADOQuery with the following SQL:

SELECT RS.*, C.Course_Name
FROM Registration_Selection RS, Course C
WHERE School_Id = :School_Id
AND       Session_Id = :Session_Id
AND       Child_Id = :Child_Id
AND       C.Course_Id = RS.Course_Id
ORDER BY C.Course_Name

I have set the following properties:

CursorLocation := clUseClient;
CursorType := KeySet;
LockType := ltBatchOptimistic;

When I try to delete a record from the resulting dataset (TADOQuery.Delete,
TADOQuery.UpdateBatch(arAll)), I get the following error message:

"Insufficient key column information for updating or refreshing"

Can anyone help me with this????

TKJ

 

Re:Deleting Records -- Please Help


Quote
>When I try to delete a record from the resulting dataset (TADOQuery.Delete,
>TADOQuery.UpdateBatch(arAll)), I get the following error message:

>"Insufficient key column information for updating or refreshing"

Do you have the IndexFieldNames property set with the key fields of the table?

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Deleting Records -- Please Help


It looks like ADO is trying to perform two deletes.  One for each table in
the FROM clause.  This is not my intention.  Is there a way to disable this?

Re:Deleting Records -- Please Help


I found the problem (See thread called "How it works").  It seems that when
using batch updates, ADO issues "DELETE" statements for each table in the
FROM clause.  Although there may be cases where someone wants it to work
like this, I didn't want that for my application.  I only wanted one DELETE
statement issued for my primary table.  To solve this problem, I put the
following statement in my AFTEROPEN event code:

  QRegSelection.Recordset.Properties.Item['Unique Table'].Value :=
'Registration_Selection';

This caused ADO to only issue one delete statement for the table that I
specified.  I hope this helps anyone else who may be experiencing the same
problem.

TKJ

Quote
Todd K. Jones wrote in message <7tdspf$g4...@forums.borland.com>...
>I have a application that has a TADOQuery with the following SQL:

>SELECT RS.*, C.Course_Name
>FROM Registration_Selection RS, Course C
>WHERE School_Id = :School_Id
>AND       Session_Id = :Session_Id
>AND       Child_Id = :Child_Id
>AND       C.Course_Id = RS.Course_Id
>ORDER BY C.Course_Name

>I have set the following properties:

>CursorLocation := clUseClient;
>CursorType := KeySet;
>LockType := ltBatchOptimistic;

>When I try to delete a record from the resulting dataset (TADOQuery.Delete,
>TADOQuery.UpdateBatch(arAll)), I get the following error message:

>"Insufficient key column information for updating or refreshing"

>Can anyone help me with this????

>TKJ

Re:Deleting Records -- Please Help


Todd K. Jones <jon...@omnisystems.com> wrote in message
news:7tga8a$6tu3@forums.borland.com...

Quote
>   QRegSelection.Recordset.Properties.Item['Unique Table'].Value :=
> 'Registration_Selection';

Thanks for sharing that solution.  I'll definitely file that  one away in
case this question comes up again.  If you don't mind, can you tell me where
you found this information?

Mark

Re:Deleting Records -- Please Help


I found it at the following link:

http://msdn.microsoft.com/library/default.htm

I then selected the following:

- Platform SDK
- Data Access Services
- Microsoft Data Access 2.5 SDK Beta
- Microsoft ActiveX Data Objects (ADO)
- Microsoft ADO Programmer's Reference
- ADO API Reference
- ADO Dynamic Properties

TKJ

Re:Deleting Records -- Please Help


Quote
"Mark Edington (Borland)" wrote:

> Todd K. Jones <jon...@omnisystems.com> wrote in message
> news:7tga8a$6tu3@forums.borland.com...

> >   QRegSelection.Recordset.Properties.Item['Unique Table'].Value :=
> > 'Registration_Selection';

> Thanks for sharing that solution.  I'll definitely file that  one away in
> case this question comes up again.  If you don't mind, can you tell me where
> you found this information?

Mark, please, don't say to us that this "feature" was not tested ...

maybe the solution by Todd work well in a variety os scenarios, but the
fact is that is not well tested ...
what if I joined three tables and want to delete in two ?
(and there must be a better/easy solution, Todd's method is a dirty
workaround)

is that nobody in borland thinked about this scenario ?

I hate this situation, instead of putting the decisions and the fine
granularity in the programmer, borland decides to put this
"intelligence" in a component, now this dumb component take decisions
for me, oh well ...

look, I know there are a lot of dumb programmers out there, lot of
people trying to use a query like a old dbase table, etc, but this
people usually choose VB.
Please, don't make us look stupids, *me* is who I want for take
control of the software, *me* is who I want for desicions in what
to do ...

like it or not, TUpdateSql was a control to permit us the behavior
of the program, you say it was cruft, now we have this problems, and
you say: 'Oh, I will annotate this workaround just in case'

I have another idea: FIX the problem.

--
  |    Sergio A. Kessler  http://sak.org.ar
-O_O-  Keep working at it... you will either succeed, or become an expert.

Re:Deleting Records -- Please Help


Quote
Sak <s...@perio.unlp.edu.ar> wrote in message

news:37FBB05F.4F3A3A75@perio.unlp.edu.ar...

Quote
> Mark, please, don't say to us that this "feature" was not tested ...

Our testing focused on the VCL components encapsulation of the ADO objects.
By default this also test ADO itself and in fact turned up a number of
different issues/bugs.  However, when it comes to actually updating data
this is always done by ADO and not the ADOExpress components.

The issue Todd brought up would be the same regardless of which development
tool was being used.  It is an issue with ADO, not Delphi.

Mark

Re:Deleting Records -- Please Help


Sak,

I find you post pretty pre-mature and offensive. The behaviour has nothing
to do w/ the ADOExpress components. I have the same problem a year ago while
developing MTS components w/ ADO using VB. I hate to see people quickly
complaining before actually doing some analysis first.

Just my $.02 and your milage may differ.

Hardy

Quote
Sak wrote in message <37FBB05F.4F3A3...@perio.unlp.edu.ar>...

>"Mark Edington (Borland)" wrote:

>> Todd K. Jones <jon...@omnisystems.com> wrote in message
>> news:7tga8a$6tu3@forums.borland.com...

>> >   QRegSelection.Recordset.Properties.Item['Unique Table'].Value :=
>> > 'Registration_Selection';

>> Thanks for sharing that solution.  I'll definitely file that  one away in
>> case this question comes up again.  If you don't mind, can you tell me
where
>> you found this information?

>Mark, please, don't say to us that this "feature" was not tested ...

>maybe the solution by Todd work well in a variety os scenarios, but the
>fact is that is not well tested ...
>what if I joined three tables and want to delete in two ?
>(and there must be a better/easy solution, Todd's method is a dirty
>workaround)

>is that nobody in borland thinked about this scenario ?

>I hate this situation, instead of putting the decisions and the fine
>granularity in the programmer, borland decides to put this
>"intelligence" in a component, now this dumb component take decisions
>for me, oh well ...

>look, I know there are a lot of dumb programmers out there, lot of
>people trying to use a query like a old dbase table, etc, but this
>people usually choose VB.
>Please, don't make us look stupids, *me* is who I want for take
>control of the software, *me* is who I want for desicions in what
>to do ...

>like it or not, TUpdateSql was a control to permit us the behavior
>of the program, you say it was cruft, now we have this problems, and
>you say: 'Oh, I will annotate this workaround just in case'

>I have another idea: FIX the problem.

>--
>  |    Sergio A. Kessler  http://sak.org.ar
>-O_O-  Keep working at it... you will either succeed, or become an expert.

Re:Deleting Records -- Please Help


Todd K. Jones <jon...@omnisystems.com> wrote in message
news:7tgdej$6tt9@forums.borland.com...

Quote
> I found it at the following link:

> http://msdn.microsoft.com/library/default.htm

> I then selected the following:

Thank you very much.  Also, just FYI if you want to post a URL to the exact
page you can find out what it is by turning off the TOC.  I'm not
complaining mind you, it's just that one click is easier than 10 :).

http://msdn.microsoft.com/isapi/msdnlib2.idc?theURL=/library/sdkdoc/d...
ad971h.htm

Also, it's worth noting that is a new topic in the 2.5 SDK.  I'm glad they
finally started doc'ing the dynamic properties.  There's alot of stuff in
there, but most of it is tough to use without docs (although most are
covered quickly in the OLE DB reference).

Thanks again,

Mark

Re:Deleting Records -- Please Help


Quote
"Mark Edington (Borland)" wrote:

> Sak <s...@perio.unlp.edu.ar> wrote in message
> news:37FBB05F.4F3A3A75@perio.unlp.edu.ar...

> > Mark, please, don't say to us that this "feature" was not tested ...

> Our testing focused on the VCL components encapsulation of the ADO objects.
> By default this also test ADO itself and in fact turned up a number of
> different issues/bugs.  However, when it comes to actually updating data
> this is always done by ADO and not the ADOExpress components.

> The issue Todd brought up would be the same regardless of which development
> tool was being used.  It is an issue with ADO, not Delphi.

I don't care about other development tools, I care about Delphi,
and we all know that windows is broken, but a company like Borland
must provide nice workarounds (like a TUpdateSql or insert/update/delete
properties in the TADOQuery itself) instead of blaming M$ for their
bugs.

It was a *borland* decision (not a M$ one) to make ADO components,
then do it rigth (_facing_ and workarounding the problems) or not
at all.
Don't blame M$ for borland decisions and poor job facing problems.

And the decision to remove TUpdateSql was your decision... (AFAIK)

(and a pure ODBC solution would have been _much_ more desirable)

--
  |    Sergio A. Kessler  http://sak.org.ar
-O_O-  Keep working at it... you will either succeed, or become an expert.

Re:Deleting Records -- Please Help


Quote
Hardy Yau wrote:

> Sak,

> I find you post pretty pre-mature and offensive. The behaviour has nothing
> to do w/ the ADOExpress components. I have the same problem a year ago while
> developing MTS components w/ ADO using VB. I hate to see people quickly
> complaining before actually doing some analysis first.

borland should have been aware of this *BIG* hole and *BIG* lack
of control.

look, M$ has years of history doing pretty bad software, if borland
want to depend more and more about this software, that's ok, is their
rigth.

but if borland want to come up with a good and robust development
tools they have to do their own thing rigth or /at least/ face the
problems and provide nice workarounds, instead of blaming M$.

and there is no much analysis to do, M$ is a factory of bad designed
software, and now Borland want to depend more and more on this soft,
you do the math.

PS: sorry if you feel alluded about the dumb programmers for
using VB.

--
  |    Sergio A. Kessler  http://sak.org.ar
-O_O-  Keep working at it... you will either succeed, or become an expert.

Re:Deleting Records -- Please Help


If Borland has to follow your recommendation, they might just be better off
to retreat from Windows, anyway Windows is from M$.
Quote
Sak wrote in message <37FCE91A.24AE8...@perio.unlp.edu.ar>...

>borland should have been aware of this *BIG* hole and *BIG* lack
>of control.

>look, M$ has years of history doing pretty bad software, if borland
>want to depend more and more about this software, that's ok, is their
>rigth.

>but if borland want to come up with a good and robust development
>tools they have to do their own thing rigth or /at least/ face the
>problems and provide nice workarounds, instead of blaming M$.

>and there is no much analysis to do, M$ is a factory of bad designed
>software, and now Borland want to depend more and more on this soft,
>you do the math.

>PS: sorry if you feel alluded about the dumb programmers for
>using VB.

>--
>  |    Sergio A. Kessler  http://sak.org.ar
>-O_O-  Keep working at it... you will either succeed, or become an expert.

Re:Deleting Records -- Please Help


Quote
Hardy Yau wrote:

> If Borland has to follow your recommendation, they might just be better off
> to retreat from Windows, anyway Windows is from M$.

I'm not saying that, I'm saying that borland should not follow
M$ *BLINDLY*

--
  |    Sergio A. Kessler  http://sak.org.ar
-O_O-  You can have it Soon, Cheap, and Working; choose *two*.

Re:Deleting Records -- Please Help


Mark Edington (Borland) <medington@_nolunchmeat_inprise.com> wrote in
message news:7tifmk$mpe18@forums.borland.com...

Quote
> Todd K. Jones <jon...@omnisystems.com> wrote in message
> news:7tgdej$6tt9@forums.borland.com...

> > I found it at the following link:

> > http://msdn.microsoft.com/library/default.htm

> > I then selected the following:

> Thank you very much.  Also, just FYI if you want to post a URL to the
exact
> page you can find out what it is by turning off the TOC.  I'm not
> complaining mind you, it's just that one click is easier than 10 :).

http://msdn.microsoft.com/isapi/msdnlib2.idc?theURL=/library/sdkdoc/d...

Quote
> ad971h.htm

> Also, it's worth noting that is a new topic in the 2.5 SDK.  I'm glad they
> finally started doc'ing the dynamic properties.  There's alot of stuff in
> there, but most of it is tough to use without docs (although most are
> covered quickly in the OLE DB reference).

> Thanks again,

> Mark

Then again, when microsoft moves the pages around, the 10 click solution
still works.  Usually.  (at least in this case)
Go to page: [1] [2]

Other Threads