none
Bug with dynamic DataSet at Design Time -- duplicated Table columns? RRS feed

  • Question

  • I am new here and originally posted this under VS Extensibility forum.  Hoping to find a workaround.

    I've tested and witness this issue in both C# and VB Express editions of Visual Studio... 

    I have a custom Dataset derived class that dynamically creates tables in its constructor.  Adding this component to the Data Source tool window displayes a treeview where the tree nodes represent the Dataset's Table names as well as the Column names within each Table.  These can supposedly be dragged and dropped onto a form in the Forms Designer.

    My problem is:  All the Tables in my Dataset object (on the Design Time Data Sources tab) display the same list of columns (and only those) which are the column collection of the first Table added to the Dataset.

    The problem is easy to replicate:

    public class MyDataSet : DataSet
    
    {
    
        public MyDataSet() : base("MyDataSet")
    
        {
    
              this.Tables.Add("Table1", "myNamespace");
    
              this.Tables.Add("Table2", "myNamespace");
    
              this.Tables["Table2"].Columns.Add("strField1", typeof(string));
    
              this.Tables["Table1"].Columns.Add("strField2", typeof(string));
    
              this.Tables["Table1"].Columns.Add("strField3", typeof(string));
    
              this.Tables["Table1"].Columns.Add("boolField4", typeof(bool));
    
         }
    
    }			
    
    
    
    

    The constructor is executed in Design Time and the object appears on the Data Source tab as a tree:  two Tables and their associated columns.  However, both tables reflect the same three columns (the 3 added to "Table1").  The column added to "Table2" is not displayed for that Table nor anywhere in the tree.

    The Tables appear to be correctly defined at Run Time, but I was hoping to get at them in Design Time to take advantage of drag and drop Form design.  I am stuck.

    Does anyone know of a workaround or correction for this issue?  Is it a bug?  Perhaps I should be serializing the object at Design Time in the constructor?

    Thanks.

    Steve
    Wednesday, July 8, 2009 8:34 PM

Answers

  • This forum is for the code visualizer. Looks like you are looking for help in the ADO.Net DataSet designer. Visit http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataset/threads if that's the case.

    Please mark the post answered your question as the answer, and click the chartreuse pyramid floating over nothingness/null to mark other helpful posts as helpful. This posting is provided "AS IS" with no warranties, and confers no rights.
    Visual C++ MVP
    • Marked as answer by Steven.M Thursday, July 9, 2009 2:08 AM
    Wednesday, July 8, 2009 10:22 PM

All replies

  • This forum is for the code visualizer. Looks like you are looking for help in the ADO.Net DataSet designer. Visit http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataset/threads if that's the case.

    Please mark the post answered your question as the answer, and click the chartreuse pyramid floating over nothingness/null to mark other helpful posts as helpful. This posting is provided "AS IS" with no warranties, and confers no rights.
    Visual C++ MVP
    • Marked as answer by Steven.M Thursday, July 9, 2009 2:08 AM
    Wednesday, July 8, 2009 10:22 PM
  • Thanks for the guidance!  Appreciated.
    Thursday, July 9, 2009 1:20 AM