Hello,

My goal with the question is to make sure I'm not doing
this the hardest way possible. I have a dataAdapter (da1)
which I create in the formload event and I have 2 source
tables (tbl1 and tbl2) from a sql server which I join in
the da1 select command. Then I fill a table (t0) in a
dataset (ds1) with this set of data from the 2 source
tables. To add new data to the source tables (tbl1 and
tbl2) or to update the data in the source tables I create
2 additional Adapters (da2, da3) which add tables t1 and
t2 to ds1. da2 links to tbl1 and da3 links to tbl2. I
update the fields for tbl1 and call da2.Update(ds1, "t1"),
then I update the fields for tbl2 and call da3.Update
(ds1, "t2"). The other thing I tried was to reset the
selectcommand for da1 from the join sql to Select * from
tbl1 and then again da1.Update(ds1, "t1"), then change the
selectcommand to select * from tbl2...

The question is if I am being inefficient here or
overkill, or is this how it is done? In other words, if I
stuff 2 tables in da1 without joining them, I believe I
can only reference one set of data in the adapter unlike a
dataset. Is this correct? So for Insert or Delete
operations I need one adapter per table?

Thanks,
Rich

Re: DataAdapter & multiple tables question by Rajesh

Rajesh
Thu Mar 04 21:40:06 CST 2004

I think, you can perform little bit better if you use stored procedures.

ur selectcommand works with stored procedure which returns joined result
from tbl1 and tbl2.

ur insert/update/deletecommand should call stored procedure. in that stored
procedure, you should write your logic to manipulate tbl1 and tbl2.

only one dataadapter will be enough for it.

Hope this helps.

Rajesh Patel


"Rich" <anonymous@discussions.microsoft.com> wrote in message
news:703c01c4022f$3245f320$a301280a@phx.gbl...
> Hello,
>
> My goal with the question is to make sure I'm not doing
> this the hardest way possible. I have a dataAdapter (da1)
> which I create in the formload event and I have 2 source
> tables (tbl1 and tbl2) from a sql server which I join in
> the da1 select command. Then I fill a table (t0) in a
> dataset (ds1) with this set of data from the 2 source
> tables. To add new data to the source tables (tbl1 and
> tbl2) or to update the data in the source tables I create
> 2 additional Adapters (da2, da3) which add tables t1 and
> t2 to ds1. da2 links to tbl1 and da3 links to tbl2. I
> update the fields for tbl1 and call da2.Update(ds1, "t1"),
> then I update the fields for tbl2 and call da3.Update
> (ds1, "t2"). The other thing I tried was to reset the
> selectcommand for da1 from the join sql to Select * from
> tbl1 and then again da1.Update(ds1, "t1"), then change the
> selectcommand to select * from tbl2...
>
> The question is if I am being inefficient here or
> overkill, or is this how it is done? In other words, if I
> stuff 2 tables in da1 without joining them, I believe I
> can only reference one set of data in the adapter unlike a
> dataset. Is this correct? So for Insert or Delete
> operations I need one adapter per table?
>
> Thanks,
> Rich



Re: DataAdapter & multiple tables question by Rich

Rich
Fri Mar 05 10:11:25 CST 2004

Thanks. yes. This helps. I am just starting out
with .Net/Ado.Net. I know how to use com ADO and invoke
SPs - cmd.CommandType = adCmdStoredProc, cmd.CommandText
= "YourSP", Set RS = cmd.Execute. In .Net I suppose I
could do all that in the propertysheet of the
DataAdapter.

Thank you for enlightening me to this.

Rich

>-----Original Message-----
>I think, you can perform little bit better if you use
stored procedures.
>
>ur selectcommand works with stored procedure which
returns joined result
>from tbl1 and tbl2.
>
>ur insert/update/deletecommand should call stored
procedure. in that stored
>procedure, you should write your logic to manipulate tbl1
and tbl2.
>
>only one dataadapter will be enough for it.
>
>Hope this helps.
>
>Rajesh Patel
>
>
>"Rich" <anonymous@discussions.microsoft.com> wrote in
message
>news:703c01c4022f$3245f320$a301280a@phx.gbl...
>> Hello,
>>
>> My goal with the question is to make sure I'm not doing
>> this the hardest way possible. I have a dataAdapter
(da1)
>> which I create in the formload event and I have 2 source
>> tables (tbl1 and tbl2) from a sql server which I join in
>> the da1 select command. Then I fill a table (t0) in a
>> dataset (ds1) with this set of data from the 2 source
>> tables. To add new data to the source tables (tbl1 and
>> tbl2) or to update the data in the source tables I
create
>> 2 additional Adapters (da2, da3) which add tables t1
and
>> t2 to ds1. da2 links to tbl1 and da3 links to tbl2. I
>> update the fields for tbl1 and call da2.Update
(ds1, "t1"),
>> then I update the fields for tbl2 and call da3.Update
>> (ds1, "t2"). The other thing I tried was to reset the
>> selectcommand for da1 from the join sql to Select * from
>> tbl1 and then again da1.Update(ds1, "t1"), then change
the
>> selectcommand to select * from tbl2...
>>
>> The question is if I am being inefficient here or
>> overkill, or is this how it is done? In other words,
if I
>> stuff 2 tables in da1 without joining them, I believe I
>> can only reference one set of data in the adapter
unlike a
>> dataset. Is this correct? So for Insert or Delete
>> operations I need one adapter per table?
>>
>> Thanks,
>> Rich
>
>
>.
>