views:

9

answers:

0

My VB WPF app is using strongly typed datasets. The connection string is set in the app.config file and is changed via the application settings designer gui. During development I connect to the test database on another server. I want a screen indicator to make it clear that the app is connected to test data.

I know I could parse the connection string, but I'm trying something different. I noticed (using intellisense) that the TableAdapterManager has a connection property that is a SQLConnection. I'm trying to get at the underlying SQLConnection.DataSource property to determine whether I'm connected to the test database. For some reason I cannot cast the TableAdapterManager.Connection to a SQLClient.SQLConnection...

CType(_labTableAdapterManager.Connection, System.Data.SqlClient.SqlConnection)

generates the error "SQLConnection cannot be converted to String". Huh?

Any suggestions?