Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a VB.NET windows app which calls a single stored proc which returns a dataset containing multiple tables.

 

At the moment the only way I can seem to refernence the various tables is through the standard code: -

 

DataSet.Tables("Table"), DataSet.Tables("Table1"), DataSet.Tables("Table2") .... and so on.

 

Is there any way that I can assign specific names to the individual tables when the dataset is created?????

Posted

Why dont you generate a Dataset File. Dataset1.xsd

after generating that you just need to add an instance of it with in your application. and you can fill its tables.

The one and only

Dr. Madz

eee-m@il

Posted

Thanks for the replies ..... but I'm still missing something.

 

Creating a DataSet schema file will allow me to declare 2 tables within the dataset eg. Author & Title ..... fine.

 

However if I call my stored procedure (which will return one record set for Authors and another for Titles) with the command

 

m_odaWhatever.Fill(m_dsWhatever, "Authors")

 

the tables in the DataSet are doing to be called Authors & Authors1 - I want them to be called Authors & Title.

 

How do I use the .xsd to acheive this??

 

Cheers!!!!

  • *Experts*
Posted

If via visual studio: right click the dataset in question and select properties. In the Properties window, select the Tables property, and then click the ellipsis button. The Tables Collection Editor opens. Select the table and change both the Name and TableName properties to the name you want to use.

 

If via run time: the following code creates the Authors table:

 

Dim dtAuthors As System.Data.DataTable
dtAuthors = Me.dsDataSet.Tables.Add("Authors")
[code=visualbasic]

Then you fill the dataset thus:
[code=visualbasic]
Me.daDataAdapter.Fill(Me.dsDataSet.Tables("Authors"))

 

Jon

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...