Board index » delphi » How can we update or insert dataset with using Joined Query

How can we update or insert dataset with using Joined Query

   We are using, delphi 50 with update pack 1 and ADO with mdac_type 2 and
MS SQL Server 7 platform.

In BDE there is no problem to update or insert in Joined Query logic it is
using Updatequery component but we could 'nt  do these things in ADO.
Would you give us a simple code which can do update , insert with Joined
Query DataSet?

 

Re:How can we update or insert dataset with using Joined Query


Hi
in SQL 7 you just update the Resultset and there you are
Joins are not Read only like in paradox

Regards

David   agros...@arava.co.il

Quote
"G?ktan Elgin" <el...@havelsan.com.tr> wrote in message

news:8smp1k$7l929@bornews.borland.com...
Quote
>    We are using, delphi 50 with update pack 1 and ADO with mdac_type 2 and
> MS SQL Server 7 platform.

> In BDE there is no problem to update or insert in Joined Query logic it is
> using Updatequery component but we could 'nt  do these things in ADO.
> Would you give us a simple code which can do update , insert with Joined
> Query DataSet?

Re:How can we update or insert dataset with using Joined Query


Thanks to your reply;
We want to update or insert only one table in the Joined Query DataSet
In this situation How can we do that?

G?ktan   el...@havelsan.com.tr

Quote
David B.E <agros...@arava.co.il> wrote in message

news:8snl18$h4h12@bornews.borland.com...
Quote
> Hi
> in SQL 7 you just update the Resultset and there you are
> Joins are not Read only like in paradox

> Regards

> David   agros...@arava.co.il

> "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> news:8smp1k$7l929@bornews.borland.com...
> >    We are using, delphi 50 with update pack 1 and ADO with mdac_type 2
and
> > MS SQL Server 7 platform.

> > In BDE there is no problem to update or insert in Joined Query logic it
is
> > using Updatequery component but we could 'nt  do these things in ADO.
> > Would you give us a simple code which can do update , insert with Joined
> > Query DataSet?

Re:How can we update or insert dataset with using Joined Query


RecordSet has a dinamic property called Uniq Table where you can write the
table which will be affected
if you need more info about it you can email me

Regards

     David   agros...@arava.co.il

Quote
"G?ktan Elgin" <el...@havelsan.com.tr> wrote in message

news:8souid$493@bornews.borland.com...
Quote
> Thanks to your reply;
> We want to update or insert only one table in the Joined Query DataSet
> In this situation How can we do that?

> G?ktan   el...@havelsan.com.tr

> David B.E <agros...@arava.co.il> wrote in message
> news:8snl18$h4h12@bornews.borland.com...
> > Hi
> > in SQL 7 you just update the Resultset and there you are
> > Joins are not Read only like in paradox

> > Regards

> > David   agros...@arava.co.il

> > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > news:8smp1k$7l929@bornews.borland.com...
> > >    We are using, delphi 50 with update pack 1 and ADO with mdac_type 2
> and
> > > MS SQL Server 7 platform.

> > > In BDE there is no problem to update or insert in Joined Query logic
it
> is
> > > using Updatequery component but we could 'nt  do these things in ADO.
> > > Would you give us a simple code which can do update , insert with
Joined
> > > Query DataSet?

Re:How can we update or insert dataset with using Joined Query


I have the same problem but i can't find
the property RecordSet.UniqTable
Regards
Quote
"David B.E" <agros...@arava.co.il> wrote in message

news:8t2dlb$2gh8@bornews.borland.com...
Quote
> RecordSet has a dinamic property called Uniq Table where you can write the
> table which will be affected
> if you need more info about it you can email me

> Regards

>      David   agros...@arava.co.il

> "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> news:8souid$493@bornews.borland.com...
> > Thanks to your reply;
> > We want to update or insert only one table in the Joined Query DataSet
> > In this situation How can we do that?

> > G?ktan   el...@havelsan.com.tr

> > David B.E <agros...@arava.co.il> wrote in message
> > news:8snl18$h4h12@bornews.borland.com...
> > > Hi
> > > in SQL 7 you just update the Resultset and there you are
> > > Joins are not Read only like in paradox

> > > Regards

> > > David   agros...@arava.co.il

> > > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > > news:8smp1k$7l929@bornews.borland.com...
> > > >    We are using, delphi 50 with update pack 1 and ADO with mdac_type
2
> > and
> > > > MS SQL Server 7 platform.

> > > > In BDE there is no problem to update or insert in Joined Query logic
> it
> > is
> > > > using Updatequery component but we could 'nt  do these things in
ADO.
> > > > Would you give us a simple code which can do update , insert with
> Joined
> > > > Query DataSet?

Re:How can we update or insert dataset with using Joined Query


Try this:

ADOQuery.Recordset.Properties['Unique Table'].Value := 'YourMainTable';

Jan

Quote
"Nick Kilpasis" <kilpa...@megatv.com> wrote in message

news:8ur0iu$4rq2@bornews.inprise.com...
Quote
> I have the same problem but i can't find
> the property RecordSet.UniqTable
> Regards
> "David B.E" <agros...@arava.co.il> wrote in message
> news:8t2dlb$2gh8@bornews.borland.com...
> > RecordSet has a dinamic property called Uniq Table where you can write
the
> > table which will be affected
> > if you need more info about it you can email me

> > Regards

> >      David   agros...@arava.co.il

> > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > news:8souid$493@bornews.borland.com...
> > > Thanks to your reply;
> > > We want to update or insert only one table in the Joined Query DataSet
> > > In this situation How can we do that?

> > > G?ktan   el...@havelsan.com.tr

> > > David B.E <agros...@arava.co.il> wrote in message
> > > news:8snl18$h4h12@bornews.borland.com...
> > > > Hi
> > > > in SQL 7 you just update the Resultset and there you are
> > > > Joins are not Read only like in paradox

> > > > Regards

> > > > David   agros...@arava.co.il

> > > > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > > > news:8smp1k$7l929@bornews.borland.com...
> > > > >    We are using, delphi 50 with update pack 1 and ADO with
mdac_type
> 2
> > > and
> > > > > MS SQL Server 7 platform.

> > > > > In BDE there is no problem to update or insert in Joined Query
logic
> > it
> > > is
> > > > > using Updatequery component but we could 'nt  do these things in
> ADO.
> > > > > Would you give us a simple code which can do update , insert with
> > Joined
> > > > > Query DataSet?

Re:How can we update or insert dataset with using Joined Query


Thanks Jan
I try this setting but it diden't work

Quote
"Jan Gucik" <gu...@atlas.cz> wrote in message

news:8uras2$9ln1@bornews.inprise.com...
Quote
> Try this:

> ADOQuery.Recordset.Properties['Unique Table'].Value := 'YourMainTable';

> Jan

> "Nick Kilpasis" <kilpa...@megatv.com> wrote in message
> news:8ur0iu$4rq2@bornews.inprise.com...
> > I have the same problem but i can't find
> > the property RecordSet.UniqTable
> > Regards
> > "David B.E" <agros...@arava.co.il> wrote in message
> > news:8t2dlb$2gh8@bornews.borland.com...
> > > RecordSet has a dinamic property called Uniq Table where you can write
> the
> > > table which will be affected
> > > if you need more info about it you can email me

> > > Regards

> > >      David   agros...@arava.co.il

> > > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > > news:8souid$493@bornews.borland.com...
> > > > Thanks to your reply;
> > > > We want to update or insert only one table in the Joined Query
DataSet
> > > > In this situation How can we do that?

> > > > G?ktan   el...@havelsan.com.tr

> > > > David B.E <agros...@arava.co.il> wrote in message
> > > > news:8snl18$h4h12@bornews.borland.com...
> > > > > Hi
> > > > > in SQL 7 you just update the Resultset and there you are
> > > > > Joins are not Read only like in paradox

> > > > > Regards

> > > > > David   agros...@arava.co.il

> > > > > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > > > > news:8smp1k$7l929@bornews.borland.com...
> > > > > >    We are using, delphi 50 with update pack 1 and ADO with
> mdac_type
> > 2
> > > > and
> > > > > > MS SQL Server 7 platform.

> > > > > > In BDE there is no problem to update or insert in Joined Query
> logic
> > > it
> > > > is
> > > > > > using Updatequery component but we could 'nt  do these things in
> > ADO.
> > > > > > Would you give us a simple code which can do update , insert
with
> > > Joined
> > > > > > Query DataSet?

Re:How can we update or insert dataset with using Joined Query


This must be called immediately after open table.

e.g.

ADOQuery1.SQL.Text := 'SELECT * FROM MyTable LEFT JOIN MySecondTable ON
(MySecondTable.ID = MyTable.ID)';
ADOQuery1.Open;
ADOQuery1.Recordset.Properties['Unique Table'].Value := 'MyTable';

... here you can use Delphi database controls for inserting, editing etc.

Jan

Quote
"Nick Kilpasis" <kilpa...@megatv.com> wrote in message

news:3a114d0c_2@dnews...
Quote
> Thanks Jan
> I try this setting but it diden't work

> "Jan Gucik" <gu...@atlas.cz> wrote in message
> news:8uras2$9ln1@bornews.inprise.com...
> > Try this:

> > ADOQuery.Recordset.Properties['Unique Table'].Value := 'YourMainTable';

> > Jan

> > "Nick Kilpasis" <kilpa...@megatv.com> wrote in message
> > news:8ur0iu$4rq2@bornews.inprise.com...
> > > I have the same problem but i can't find
> > > the property RecordSet.UniqTable
> > > Regards
> > > "David B.E" <agros...@arava.co.il> wrote in message
> > > news:8t2dlb$2gh8@bornews.borland.com...
> > > > RecordSet has a dinamic property called Uniq Table where you can
write
> > the
> > > > table which will be affected
> > > > if you need more info about it you can email me

> > > > Regards

> > > >      David   agros...@arava.co.il

> > > > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > > > news:8souid$493@bornews.borland.com...
> > > > > Thanks to your reply;
> > > > > We want to update or insert only one table in the Joined Query
> DataSet
> > > > > In this situation How can we do that?

> > > > > G?ktan   el...@havelsan.com.tr

> > > > > David B.E <agros...@arava.co.il> wrote in message
> > > > > news:8snl18$h4h12@bornews.borland.com...
> > > > > > Hi
> > > > > > in SQL 7 you just update the Resultset and there you are
> > > > > > Joins are not Read only like in paradox

> > > > > > Regards

> > > > > > David   agros...@arava.co.il

> > > > > > "G?ktan Elgin" <el...@havelsan.com.tr> wrote in message
> > > > > > news:8smp1k$7l929@bornews.borland.com...
> > > > > > >    We are using, delphi 50 with update pack 1 and ADO with
> > mdac_type
> > > 2
> > > > > and
> > > > > > > MS SQL Server 7 platform.

> > > > > > > In BDE there is no problem to update or insert in Joined Query
> > logic
> > > > it
> > > > > is
> > > > > > > using Updatequery component but we could 'nt  do these things
in
> > > ADO.
> > > > > > > Would you give us a simple code which can do update , insert
> with
> > > > Joined
> > > > > > > Query DataSet?

Re:How can we update or insert dataset with using Joined Query


Microsoft Data Access SDK 2.6 ADO Help
"While Unique Table is set, the Delete method affects only the named table.
The AddNew, Resync, Update, and UpdateBatch methods affect any appropriate
underlying base tables of the Recordset.".

How can I make update and insert operations affect only the named unique
table ?

Quote
"Jan Gucik" <gu...@atlas.cz> wrote in message

news:8uthtu$p804@bornews.inprise.com...
Quote
> This must be called immediately after open table.

> e.g.

> ADOQuery1.SQL.Text := 'SELECT * FROM MyTable LEFT JOIN MySecondTable ON
> (MySecondTable.ID = MyTable.ID)';
> ADOQuery1.Open;
> ADOQuery1.Recordset.Properties['Unique Table'].Value := 'MyTable';

> ... here you can use Delphi database controls for inserting, editing etc.

> Jan

Re:How can we update or insert dataset with using Joined Query


From MSDN :

When the Unique Table ADO property is set, Row Fix-up mode is implemented.
The Unique Table property restricts INSERT, UPDATE, and DELETE statements
affecting the Unique Table. Columns of the base tables are updatable, but
those columns not in the Unique Table cannot be included in any update
method.

Jan

Quote
"Ali" <aa...@hotmail.com> wrote in message news:3a139491_2@dnews...
> Microsoft Data Access SDK 2.6 ADO Help
> "While Unique Table is set, the Delete method affects only the named
table.
> The AddNew, Resync, Update, and UpdateBatch methods affect any appropriate
> underlying base tables of the Recordset.".

> How can I make update and insert operations affect only the named unique
> table ?

> "Jan Gucik" <gu...@atlas.cz> wrote in message
> news:8uthtu$p804@bornews.inprise.com...
> > This must be called immediately after open table.

> > e.g.

> > ADOQuery1.SQL.Text := 'SELECT * FROM MyTable LEFT JOIN MySecondTable ON
> > (MySecondTable.ID = MyTable.ID)';
> > ADOQuery1.Open;
> > ADOQuery1.Recordset.Properties['Unique Table'].Value := 'MyTable';

> > ... here you can use Delphi database controls for inserting, editing
etc.

> > Jan

Re:How can we update or insert dataset with using Joined Query


Hi,

Microsoft Data Access SDK 2.6 ADO Help
"While Unique Table is set, the Delete method affects only the named table.
The AddNew, Resync, Update, and UpdateBatch methods affect any appropriate
underlying base tables of the Recordset.".

I have tried the statement above and I am sure that what is written  is
true.

Have you written an application and tested the accuracy of the statement,
that is from MSDN, in your message. If yes, is it possible for you to post
an example application please.

The platform I have worked is Delphi 5.0 and MS SQL 7.0.

Ali

Quote
"Jan Gucik" <gu...@atlas.cz> wrote in message

news:8v05av$pu82@bornews.inprise.com...
Quote
> From MSDN :

> When the Unique Table ADO property is set, Row Fix-up mode is implemented.
> The Unique Table property restricts INSERT, UPDATE, and DELETE statements
> affecting the Unique Table. Columns of the base tables are updatable, but
> those columns not in the Unique Table cannot be included in any update
> method.

> Jan

Re:How can we update or insert dataset with using Joined Query


Sorry, I didn't try it. I use unique table property only for deleting.
In additional,I set another dynamic property 'Resync Command' and
my joined queries are up-to-date after Update/Insert statement.

Jan.

Quote
"Ali" <aa...@hotmail.com> wrote in message news:3a1bd58d_2@dnews...
> Hi,

> Microsoft Data Access SDK 2.6 ADO Help
> "While Unique Table is set, the Delete method affects only the named
table.
> The AddNew, Resync, Update, and UpdateBatch methods affect any appropriate
> underlying base tables of the Recordset.".

> I have tried the statement above and I am sure that what is written  is
> true.

> Have you written an application and tested the accuracy of the statement,
> that is from MSDN, in your message. If yes, is it possible for you to post
> an example application please.

> The platform I have worked is Delphi 5.0 and MS SQL 7.0.

> Ali

> "Jan Gucik" <gu...@atlas.cz> wrote in message
> news:8v05av$pu82@bornews.inprise.com...
> > From MSDN :

> > When the Unique Table ADO property is set, Row Fix-up mode is
implemented.
> > The Unique Table property restricts INSERT, UPDATE, and DELETE
statements
> > affecting the Unique Table. Columns of the base tables are updatable,
but
> > those columns not in the Unique Table cannot be included in any update
> > method.

> > Jan

Other Threads