none
Designer: Getting generic table name on typed DataSet RRS feed

  • Question

  • Hi,

    I have tables on the Server Explorer. When I drag and drop on a DataSet in the designer, I get back a generic table name as "DataTable" instead of the actual table name. I can see the actual table name in the XML it gets generated in the "Select * from tablename" statement. I can see that the correct table name coming out of the Connection.GetSchema() in the DataTable object it returns.

    Please let me know where to look for the issue.

    Thanks,

    Syed.

    • Moved by lucy-liuModerator Thursday, February 2, 2012 2:42 AM it is a dataset issue (From:Visual Studio Extensibility)
    Wednesday, February 1, 2012 1:50 AM

Answers

  • Hi Allen,

    When generating Typed DataSets that include TableAdapters, there's a lot of stuff generated. I know that Sayed said that the tablename is showing up in the XML, but it's hard to say exactly what part of his XML is showing the TableName. An .xsd without all that TableAdapter junk in it is a *lot* easier to look at and understand ... I hate TableAdapters, but that's just my personal opinion ... nevermind ;0)

    The part of the XML that would correspond to the name of the DataTable that shows up in the Designer would be here:

      <xs:element name="MyDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="True" msprop:Generator_DataSetName="MyDataSet" msprop:Generator_UserDSName="MyDataSet">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="MyTable" msprop:Generator_TableClassName="MyTableDataTable" msprop:Generator_TableVarName="tableMyTable" msprop:Generator_TablePropName="MyTable" msprop:Generator_RowDeletingName="MyTableRowDeleting" msprop:Generator_UserTableName="MyTable" msprop:Generator_RowChangingName="MyTableRowChanging" msprop:Generator_RowEvHandlerName="MyTableRowChangeEventHandler" msprop:Generator_RowDeletedName="MyTableRowDeleted" msprop:Generator_RowEvArgName="MyTableRowChangeEvent" msprop:Generator_RowChangedName="MyTableRowChanged" msprop:Generator_RowClassName="MyTableRow">
              <xs:complexType>
    
    
    

    The above snippet of incomplete XML would show "MyTable" as the table name in the Designer. @Sayed -- is this where you saw the correct table name?


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    Monday, February 6, 2012 6:12 AM

All replies

  • Hi Syed,

    This is a Dataset issue, in order to give you a better support, I will move it to ADO.NET DataSet forum.

    Thank you for your understanding!

     

    Best regards,

    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, February 2, 2012 2:41 AM
    Moderator
  • Hi Syed Mahmud,

     Welcome to MSDN Froum.

    Where did you get the name 'DataTable'? When I drag a table from server explorer to the designer, the table's name in the designer is still the actual name.

    I have a table named 'Player' in my database, and I drag it to the dataset desginer, it present as below..

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, February 2, 2012 7:42 AM
    Moderator
  • Thanks Allen for the reply,

    I have my custom ado.net provider talking to a third party database. Here is the output I am getting when I drag and drop on the DataSet.

     

    I am looking at my designer code and can't figure it out why it is losing the table names.

    Best regards,

    Syed.

    Thursday, February 2, 2012 7:06 PM
  • Hi Syed Mahmud,

    I suggest you to consult the third party official forum, I'm afraid I can't repro the issue, because I have no the third party database. Sorry for little help.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Friday, February 3, 2012 1:30 AM
    Moderator
  • Open up the .xsd as XML instead of in the Designer (right-click the .xsd in the solution explorer and choose Open As ... I think that's it, this is off the top of my head, I don't have Visual Studio open at the moment, but you should be able to figure it out after you right-click). Then simply change the DataTable name in the XML. When you save it, the Designer will regenerate the Typed DataSet using the name of the table that you've changed it to.
    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    Saturday, February 4, 2012 5:59 PM
  • Hi Bonnie,

    Nice to see you again.

    I agree with you. But my puzzle is OP said he can see the actual table name in the XML file, but wrong name in the designer. I think it may caused by 3rd party provider, I couldn't repro the issue.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Monday, February 6, 2012 2:11 AM
    Moderator
  • Hi Allen,

    When generating Typed DataSets that include TableAdapters, there's a lot of stuff generated. I know that Sayed said that the tablename is showing up in the XML, but it's hard to say exactly what part of his XML is showing the TableName. An .xsd without all that TableAdapter junk in it is a *lot* easier to look at and understand ... I hate TableAdapters, but that's just my personal opinion ... nevermind ;0)

    The part of the XML that would correspond to the name of the DataTable that shows up in the Designer would be here:

      <xs:element name="MyDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="True" msprop:Generator_DataSetName="MyDataSet" msprop:Generator_UserDSName="MyDataSet">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="MyTable" msprop:Generator_TableClassName="MyTableDataTable" msprop:Generator_TableVarName="tableMyTable" msprop:Generator_TablePropName="MyTable" msprop:Generator_RowDeletingName="MyTableRowDeleting" msprop:Generator_UserTableName="MyTable" msprop:Generator_RowChangingName="MyTableRowChanging" msprop:Generator_RowEvHandlerName="MyTableRowChangeEventHandler" msprop:Generator_RowDeletedName="MyTableRowDeleted" msprop:Generator_RowEvArgName="MyTableRowChangeEvent" msprop:Generator_RowChangedName="MyTableRowChanged" msprop:Generator_RowClassName="MyTableRow">
              <xs:complexType>
    
    
    

    The above snippet of incomplete XML would show "MyTable" as the table name in the Designer. @Sayed -- is this where you saw the correct table name?


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    Monday, February 6, 2012 6:12 AM
  • Thanks Allen and Bonnie for your kindly suggestions. I have figured it out by implementing AdoDotNetObjectIdentifierConverter class and perticularly BuildString() for the "Table" typename. Now I can see table names on the DataSet designer.

    Regards,

    Syed.

    
    
    
    Monday, June 18, 2012 6:07 PM