Donate

Show Sql Server Instance On The Network In ASP.NET Web Forms

The key is the SqlDataSourceEnumerator to display all instances. You can use gridview or ajax controls for display purposes.
protected void Page_Load(object sender, EventArgs e)  
      {  
        // Retrieve the enumerator instance and then the data.  
        SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;  
        System.DataDataTable table = instance.GetDataSources();  
        // Display the contents of the table.  
        DisplayData(table);  
      }  

      private void DisplayData(System.DataDataTable table)  
      {  
        foreach (System.DataDataRow row in table.Rows)  
        {  
          foreach (System.DataDataColumn col in table.Columns)  
          {  
            Response.Write(String.Format("{0} = {1}<br>",  
              col.ColumnName, row[col]));  
          }  
        }  
      } 

Comments

  1. I am learning Asp.Net Development. Can you provide me more information regarding "sql server" and "SqlDataSource".

    ReplyDelete
    Replies
    1. Hi anna,

      there are tons of resources in the internet for sql server and sql datasource.

      You could start at Microsoft's asp.net website. Aside from that, there are customized tutorials for your needs.

      Cheers! ;)

      Delete

Post a Comment

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Bootstrap Modal In ASP.NET MVC With CRUD Operations