Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > What's the difference between a dataset's DataSetName and (Name) attributes?
 

What's the difference between a dataset's DataSetName and (Name) attributes?

What's the difference between a dataset's DataSetName and (Name) attributes? What is DataSetName used for?
Richard.Haggard  Monday, August 31, 2009 3:23 PM
Hello Richard,

Thanks for your post on MSDN forum.

The (Name) attribute in the identifier of the typed DataSet, which indicates the instance of the typed DataSet used in the code. However, the DataSetName just a Property of the typed DataSet(inherited from the DataSet class), which is a string object and indicates the name of the current DataSet. The following code would give some idea of the two things.

private void button1_Click(object sender, EventArgs e)
{
//We change the DataSetName to the string as we want,
//but we cannot change the identifier
this.northwindDataSet.DataSetName = "MyCustomName";
//northwindDataSet is the (Name) attribute.
//"MyCustomName" is the name of northwindDataSet.
MessageBox.Show(this.northwindDataSet.DataSetName);
}

Thanks
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Tuesday, September 01, 2009 8:09 AM
Well, DataSetName is a property of the dataset that defines its name.

I'm not sure what you mean by the (Name) attribute. Are you referring to a typed dataset?
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Monday, August 31, 2009 5:39 PM
Select a dataset and look at the properties. One of those properties under Design is names (Name)
Richard.Haggard  Tuesday, September 01, 2009 12:02 AM
I always build my datasets with code, so I don't have a dataset to "select".

I assume you are using the designers? If so, then I assume you are building a typed dataset. So I would guess that the name attribute is the name of the typed dataset (that is the class that maps to the actual dataset).

But I'm not certain.

Hope this helps.

www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Tuesday, September 01, 2009 3:53 AM
Hello Richard,

Thanks for your post on MSDN forum.

The (Name) attribute in the identifier of the typed DataSet, which indicates the instance of the typed DataSet used in the code. However, the DataSetName just a Property of the typed DataSet(inherited from the DataSet class), which is a string object and indicates the name of the current DataSet. The following code would give some idea of the two things.

private void button1_Click(object sender, EventArgs e)
{
//We change the DataSetName to the string as we want,
//but we cannot change the identifier
this.northwindDataSet.DataSetName = "MyCustomName";
//northwindDataSet is the (Name) attribute.
//"MyCustomName" is the name of northwindDataSet.
MessageBox.Show(this.northwindDataSet.DataSetName);
}

Thanks
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Tuesday, September 01, 2009 8:09 AM

Hello Richard,

I am writing to check the status of the issue on your side. Would you mind letting me know the result of the suggestions? If you have any additional question, welcome to post here.

Have a great day!

Thanks,
Rong-Chun Zhang


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Friday, September 04, 2009 9:29 AM

You can use google to search for other answers

Custom Search

More Threads

• Validation Exceptions not handled by the DataError Event if Cell is Highlighted
• SQL installation
• Finding a Datarow in a Datatable
• How can I bind a treeview to data returned by a CTE (Common Table Expression) in SQL-2005
• Slow processing for Databound Combobox
• Reorder of Row
• Datagridview autocomplete/suggest
• How do I create a design-time databindable list?
• Column Format in unbound DataGridView
• How to resize Rows and Columns in a DataGridView in order to adjust to the size of the container