DataSet designer in VS2005

  • Thread starter Nils Magnus Englund
  • Start date
N

Nils Magnus Englund

Hi,

I have two questions about the DataSet designer in Visual Studio 2005:

1. How can I make another TableAdapter under a DataTable which already has
one? I'm sharing the DataSet with the DataTable between two applications,
and they need separate TableAdapters...

2. I've created the DataTable with structure identical to the SQL Server
table it is based on - can I easily update (not automatically, but from the
designer) the DataTable to make the DataTable structure match the SQL Server
table? (i.e. when a column is added or modified in the SQL Server table, I
want to click a button in VS2005 so the same modification is done in the
DataTable).

Thanks!


Regards,
Nils Magnus Englund
 
G

Guest

Open a new DataSet and go to the Server Explorer. Drag the tables, one at a
time, to the DataSet Designer for the new DataSet. Does it create two
separate TableAdapters?
 
N

Nils Magnus Englund

Hi Curtis,

It creates a separate TableAdapter for each DataTable as expected, but I am
trying to create two TableAdapters on the same DataTable. I only have a
single DataTable in the DataSet. Sorry if I wasn't clear enough.

Thanks.

Regards,
Nils Magnus Englund
 
G

Guest

OK, i think i understand. I don't think you can do this with the DataSet
designer. It is pretty limited in functionality even if it is pretty nice
(creating a TableAdapter and all).

What i would do is this:


1. Create a DataSet and drop a table on it. Then configure the TableAdapter
the way you want it.

2. Create another DataSet and drop a table on it. Then configure the
TableAdapter the way you want the OTHER table adapter.

3. Open the second DataSet in XML view by right clicking on it and selecting
"Open With...". Then in the dialog that pops up, select "XML Editor" and
click OK.

4. Find the "<Tables>" node. Within the <Tables> node you'll find a
<TableAdapter> node. Copy that node and paste it into the first DataSet in
the <Tables> node.

5. Find the <xs:element name="DataSet1"> "DataSet1" is the name of your data
set when you created it. Copy that node and paste it into the first DataSet
in the dataset area (below the </xs:annotation> closing node. THIS STEP MAY
NOT BE NECESSARY.

See if that does the trick for you.

Curtis
 
C

Cor Ligthert [MVP]

Curtis,

It is very easy to do what you ask.

Open the View DataSources and use one of the four buttons in top of that to
add a datatable to a dataset.

I hope this helps,

Cor
 

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