locked
VS2010 Server Explorer Integration ( populating tables) RRS feed

  • Question

  • Hi there,


    I would like to populate Tables in Server Explorer using my method.


    For example:

    SqlObjectSupport.xml file has line

    <Services>
        <Service type="IVsDataObjectSelector" implementationType="Microsoft.VisualStudio.Data.Framework.AdoDotNet.AdoDotNetObjectSelector, Microsoft.VisualStudio.Data.Framework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

    so it calls conn.GetSchema("Tables"...........).

     

    But I do not want to do this.

     

    I want to use

    <Services>
        <Service type="IVsDataObjectSelector" >

    so it comes to

    internal class sqlObjectSelector : DataObjectSelector
    {protected override IVsDataReader SelectObjects(string typeName, object[] restrictions, string[] properties, object[] parameters)
    }

    Here I return hard coded one table. But when it finished, I do not see table. It is empty. See below how I return table/datareader.

    else if (typeName.Equals(sqlObjectTypes.Table, //rajan
                    StringComparison.OrdinalIgnoreCase))
                    {
                        DataTable dt = new DataTable("Table");
                        dt.Columns.Add("TABLE_CATALOG");
                        dt.Columns.Add("TABLE_SCHEMA");
                        dt.Columns.Add("Database");
                        dt.Columns.Add("Schema");
                        dt.Columns.Add("TABLE_NAME");
                        dt.Columns.Add("Name");
                        dt.Columns.Add("TABLE_TYPE");
                        dt.Columns.Add("Type");
                        DataRow lrow = dt.NewRow();
                        lrow["TABLE_CATALOG"] = "aaa";
                       lrow["TABLE_SCHEMA"] = "bbb";
                       lrow["Database"] = "aaa";
                        lrow["Schema"] = "bbb";
                        lrow["TABLE_NAME"] = "ii";
                        lrow["Name"] = "ii";
                        lrow["TABLE_TYPE"] = "TABLE";
                        lrow["Type"] = "TABLE";
                        dt.Rows.Add(lrow);
                       
                        dt.AcceptChanges();
                        DataTableReader dr = dt.CreateDataReader();
                       
                        return new AdoDotNetReader(dr);
                       
                    }
      {

    Please help me. Where is my problem?

    Regards,

    Rajan


    Rajan
    Monday, January 23, 2012 8:53 PM

Answers

  • Hi Yi,

    Thanks for your response.

    It looks like this problem is resolved.

    When I took out 'BASE TABLE' form this line

    <Selection type="Table" restrictions="null,null,null,BASE TABLE"> in 'sqlViewSupport.xml' file, it worked.

     

    Please explain me the role of 'BASE TABLE'. Why it is stopping populating tables?

    Regards,

    Rajan


    Rajan
    • Marked as answer by rajank Tuesday, January 31, 2012 5:08 PM
    Tuesday, January 24, 2012 6:26 PM

All replies

  • Hello ,

    Thank you for your question.

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, January 24, 2012 2:55 AM
  • Hi Yi,

    Thanks for your response.

    It looks like this problem is resolved.

    When I took out 'BASE TABLE' form this line

    <Selection type="Table" restrictions="null,null,null,BASE TABLE"> in 'sqlViewSupport.xml' file, it worked.

     

    Please explain me the role of 'BASE TABLE'. Why it is stopping populating tables?

    Regards,

    Rajan


    Rajan
    • Marked as answer by rajank Tuesday, January 31, 2012 5:08 PM
    Tuesday, January 24, 2012 6:26 PM