Newbie DataAdapter Questions

  • Thread starter Thread starter byahne
  • Start date Start date
B

byahne

I am new to ADO.Net. I'm currently attempting to prototype an ASP.Net
Solution for a customer. I have the following scenario and I'm not
sure what the "best" direction is...

We have two tables that have a 1 to 1 relationship. We have decided
to use strongly-typed datasets for a variety of reasons. The
application needs to access / display / allow edit of information in
both tables simultaneously preferrably through a GridView.

I have tried a few approaches including:

- creating stored procedures for insert, update, delete, and select
that joins the two tables and appropriate update of data in the
database. While this approach worked, it was somewhat clunky to
implement and my customer has a desire to avoid stored procedures for
all of their data maintenance activities.
- creating a DataSet containing the two tables associated with a
Relation. The issue we have here is that we are unable to bind a
GridView to both tables simultaneously and edit both sets of data
simultaneously.
- created a single DataAdapter that performs a select with the
appropriate join. I then attempted to create a customer InsertCommand
that would insert into two different tables, however the designer
indicated it couldn't parse the query and wouldn't let me complete the
action.

My question is, what is the "best practice" approach for implementing
functionality like this in a strongly-typed dataset?

Any guidance would be appreciated.
 
Please ignore I fixed it myself. The approach that seems to be the
most straightforward for my scenario is having a single data adapter
as I mentioned in my previous post. The error I was getting is that
the designer couldn't graphically display the multi-table insert
command that I had typed in (but who cares). I selected to "ignore"
and it maintains the query correctly. So my adapter has a JOIN in my
select and then I have 3 custom SQL queries for update, delete, and
insert that all perform operations on both tables. From the
applications perspective, this is now just one logical table, even
though physically, it's two.
 
Back
Top