Datatables and TableAdapters in separate files

J

Joel Lyons

I've been using the VS 2005 wizards to generate strongly-typed datasets,
datatables, and table adapters for a client/server application. I use the
table adapters on the server to connect to the database and retrieve
datatables. I then return those datatables to the client. I would really
like to have the datatable definitions in one assembly (distributed with the
client application) and the tableadapters in another assembly (only needed
on the server, has a bunch of code and connection strings).

It was fairly easy to split them up manually and compile them into separate
assemblies. Of course, once I do that the designer can't handle the
tableadapters any more so it makes it very difficult to upgrade and maintain
them.

It would be nice if the VS designer allowed us to generate them separately
so they could be compiled into separate assemblies.

Anybody have any thoughts/ideas on this? What is the underlying tool that
VS uses to generate table adapters? Perhaps it supports this kind of thing.

Joel
 
W

William \(Bill\) Vaughn

Download the Orcas beta. See if their new approach is easier to use.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
J

Jim Rand

Using VS 2005, do the following.

1) Create a separate project
2) Create a new component
3) Drag data adapters onto it - mark each adapter as public
4) Optionally generate a dataset.

Now your frontend can reference the dataset and the backend can reference
both the dataset and adapter component.

This is the way it was done in VS 2003 and is still supported in VS 2005.
Your data adapters are separated from the dataset.
 
J

Joel Lyons

I guess I'm not following you Jim. I've created a new project and added a
new component (right click project, "Add", then "Component". I end up with
a Component1 class opened in design view. I then try to find "data adapter"
in the toolbox to no avail. I then try to drag tables or stored procs from
the data connection (in server explorer) onto the design surface and nothing
happens.

What am I missing? Thanks for your patience.
 
J

Jim Rand

Hi Joel,

With the component surface open,

1) Right click the Data tab of the toolbox
2) Select "Choose items..." This will open the Choose Toolbox Items dialog
box
3) On the .NET Framework components, check the SqlDataAdapter and
SqlConnection items. They are in the Namespace System.Data.SqlClient.
4) Press the OK button.

Drag the SqlDataAdapter onto your designer and you are on the way.

Enjoy.

Jim
 
J

Joel Lyons

Ah, I see!
Thanks Jim

Jim Rand said:
Hi Joel,

With the component surface open,

1) Right click the Data tab of the toolbox
2) Select "Choose items..." This will open the Choose Toolbox Items
dialog box
3) On the .NET Framework components, check the SqlDataAdapter and
SqlConnection items. They are in the Namespace System.Data.SqlClient.
4) Press the OK button.

Drag the SqlDataAdapter onto your designer and you are on the way.

Enjoy.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top