Sunday, January 29, 2006

There's a cool new .net 2.0 feature I didn't know about until I needed to do this a few days ago. If your application has FullTrust, you can use the System.Data.Sql.SqlDataSourceEnumerator to get a list of available SQL servers (2000 and 2005 only). The query returns a DataTable which you can just attach to a combobox or drop down list.

 Dim instance As SqlDataSourceEnumerator =      SqlDataSourceEnumerator.Instance
 Dim dt As DataTable = instance.GetDataSources()

Remember, though, this requires the assembly to have full trust. There is not a specific permission you can apply to use this otherwise.



Don't Forget: www.acehaid.org
Sunday, January 29, 2006 1:50:05 PM (Eastern Standard Time, UTC-05:00)  #     |  Comments [0]  | 
Comments are closed.