Respondida Server Explorer in WPF application?

  • 2012年8月10日 上午 06:23
     
     

    Hi,

           I need to open Server Explorer in my WPF application.

    that means its like a Visual Studio 2010. I need to show all the Databases in a treeview model.

    if i right click the table i shoud open all the Data's.

    how can i start this?

所有回覆

  • 2012年8月10日 上午 08:05
     
     

    you need to connect to your server fist with some data connection. 

    then fire queries to Master tables to get a list of data base objects and render them in tree view.

  • 2012年8月10日 上午 08:29
     
     

    Hi Aswini,

                      Thanks for your reply.

    I need to show all the Databases first in a treeview of WPF window. Then If they clicking Databasename, it will expand, and Displays all tables,

    In further if they clicking the data's will shown.

    I like to do this some Dynamic approach. anybody Guided me? 

  • 2012年8月11日 下午 12:39
     
     已答覆

    Ok , Here is the steps 

    Every SQL Server Data Base has a master data base that is actually inventory of all data base item and we can use them when required 

    Please explore theses steps if it work for you 

    1. Connect to your database server with master database in connection string 
    2. Execute sp "Execute master.sys.sp_databases"  this will give you list of databases like below
    3. Now query to get all system object  "select * from master.sys.all_objects"
    4. Using the joins of these two you can dig out further information 
    5. There are sever other SP and views in master database that can help you to achieve exact information like "sys.all_views"

    To query data base you  should use ADO.Net 

    Hope it will help 

  • 2012年8月12日 下午 02:36
     
     提議的解答

    Then you need to use these stored procedures.

    Sp_Sysdatabases

    sysobjects

    syscolumns

    etc... All System defined stored procedures to query meta-data

    __________________________________________________________________

    Do Vote for the answers and propose the answer

    • 已提議為解答 kishhr 2012年8月12日 下午 02:36
    •