dobbo Posted May 14, 2003 Posted May 14, 2003 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????? Quote
Madz Posted May 14, 2003 Posted May 14, 2003 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. Quote The one and only Dr. Madz eee-m@il
hog Posted May 14, 2003 Posted May 14, 2003 try this: m_odaWhatever.Fill(m_dsWhatever, "TableNameWhatever") Quote My website
dobbo Posted May 15, 2003 Author Posted May 15, 2003 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!!!! Quote
*Experts* jfackler Posted May 15, 2003 *Experts* Posted May 15, 2003 Are you adding the data tables to the dataset using visual studio or at run time? Jon Quote
*Experts* jfackler Posted May 15, 2003 *Experts* Posted May 15, 2003 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.