"unique table" problem

"unique table" problem

Post by Keith G Hi » Wed, 29 Jun 2005 13:10:21


I understand that if a TadoDataset's command text is made up of joined
tables that if one wishes to delete records via the dataset (or rather the
grid it's associated with) you have to set the Unique Table property to the
table where you want the delete to occur. I understand that this needs to
be done *after* the dataset is made active.

I've done this and it works fine in one place. In this one place in code,
the dataset's command text is explicitly set and made active each time a
master dataset's row changes. There is no actual master/detail set up
between these two datasets using the IndexFieldNames, MasterFields and
Parameters properties. The detail's command text is reset in code each time
the master moves to a different record (on the master grid's
FocusedRecordChange event).

Here's the problem. It doesn't work in the place where I have master/detail
datasets that are actually using the master/detail configuration with
IndexFieldNames, MasterField and Parameters. That dataset is made active
when the form opens. I set the Unique Table property to the appropriate
table in the form create event just below teh dataset is made active. When I
try to delete from the associated grid, I get an error as if the Unique
Table were not set. Is there a property in the detail dataset that I need to
set to make this work correctly? If not, do I need to reset the Unique Table
every time the master changes rows?

With this problem and the record pointer moving problem I posted a few
minutes ago, I'm wondering if I'd be better off just using brute force and
going back to the stored procedure method. I hope I don't have to do that
though. There must be a way to make this work as desired! :-)

Thanks,

Keith
 
 
 

"unique table" problem

Post by Viatchesla » Wed, 29 Jun 2005 22:49:44

Try BetterADODataSet ( http://www.yqcomputer.com/ ), it has property
Unique_Table and will set it after activating dataset.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.yqcomputer.com/ - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.yqcomputer.com/ - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Keith G Hicks" < XXXX@XXXXX.COM >

>I understand that if a TadoDataset's command text is made up of joine>
> tables that if one wishes to delete records via the dataset (or rather th>
> grid it's associated with) you have to set the Unique Table property to>
> th>
> table where you want the delete to occur. I understand that this needs t>
> be done *after* the dataset is made active>
> I've done this and it works fine in one place. In this one place in code>
> the dataset's command text is explicitly set and made active each time >
> master dataset's row changes. There is no actual master/detail set u>
> between these two datasets using the IndexFieldNames, MasterFields an>
> Parameters properties. The detail's command text is reset in code each>
> tim>
> the master moves to a different record (on the master grid'>
> FocusedRecordChange event)>
> Here's the problem. It doesn't work in the place where I have>
> master/detai>
> datasets that are actually using the master/detail configuration wit>
> IndexFieldNames, MasterField and Parameters. That dataset is made activ>
> when the form opens. I set the Unique Table property to the appropriat>
> table in the form create event just below teh dataset is made active. When>
> >
> try to delete from the associated grid, I get an error as if the Uniqu>
> Table were not set. Is there a property in the detail dataset that I need>
> t>
> set to make this work correctly? If not, do I need to reset the Unique>
> Tabl>
> every time the master changes rows>
> With this problem and the record pointer moving problem I posted a fe>
> minutes ago, I'm wondering if I'd be better off just using brute force an>
> going back to the stored procedure method. I hope I don't have to do tha>
> though. There must be a way to make this work as desired! :->
> Thanks>
> Keit>
>

 
 
 

"unique table" problem

Post by Keith G Hi » Thu, 30 Jun 2005 00:41:04

Vassiliev,

That's where I remember seeing it! I knew it was familar from here
somewhere. I was using that component some time ago for something else and
didn't need it for the current project. Thanks. I'll give that a shot. :-)

Keith



Try BetterADODataSet ( http://www.yqcomputer.com/ ), it has property
Unique_Table and will set it after activating dataset.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.yqcomputer.com/ - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.yqcomputer.com/ - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
 
 
 

"unique table" problem

Post by Keith G Hi » Thu, 30 Jun 2005 00:45:54

2 other questions:

1. Last night I ended up setting the UniqueTable in the AfterScroll event of
the TAdoDataset and it seems to work just fine. Does anyone see any problem
with that?

2. Is it ok to mix BetterADO with just regular TAdoDataset in same forms and
application? I don't need it everywhere and am not going to go changing it
all through my current project. Just too much work.

Thanks,

Keith



Try BetterADODataSet ( http://www.yqcomputer.com/ ), it has property
Unique_Table and will set it after activating dataset.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.yqcomputer.com/ - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.yqcomputer.com/ - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
 
 
 

"unique table" problem

Post by Viatchesla » Thu, 30 Jun 2005 05:45:09

It is OK to mix BetterADO with other ADO components. Every ADO dataset works
with own ADO recordset, unless you do not use something like:

DataSet2.Recordset := DataSet1.Recordset;

If you will want to replace all TADODataSet to TBetterADODataSet, use
GExperts ( http://www.yqcomputer.com/ ).

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.yqcomputer.com/ - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.yqcomputer.com/ - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Keith G Hicks" < XXXX@XXXXX.COM >

>2 other questions>
> 1. Last night I ended up setting the UniqueTable in the AfterScroll event>
> o>
> the TAdoDataset and it seems to work just fine. Does anyone see any>
> proble>
> with that>
> 2. Is it ok to mix BetterADO with just regular TAdoDataset in same forms>
> an>
> application? I don't need it everywhere and am not going to go changing>
> i>
> all through my current project. Just too much work>
> Thanks>
> Keit>
> "Viatcheslav V. Vassilie<" wrote in messag>

> Try BetterADODataSet ( http://www.yqcomputer.com/ ), it has propert>
> Unique_Table and will set it after activating dataset>
> //----------------------------------------->
> Regards>
> Vassiliev V. V>
> http://www.yqcomputer.com/ - using .Net objects in Delphi for Win32 >
> ADO.Ne>
> http://www.yqcomputer.com/ - The fastest way to access MS SQL Server>
> MS Jet (Access) and Interbase (through OLEDB>
>
 
 
 

"unique table" problem

Post by Keith G Hi » Thu, 30 Jun 2005 23:24:41

Thanks Brian. I'll move it.




of
problem
I believe that the Unique Table property is re-set to its null default after
a
ReQuery which is what the master detail link does.
I would set the property in the Beforedelete. AfterScroll has some overhead
if
you don't need it don't use it.