Make an ADO.Net connection when you have an SMO connection

When you have an SMO connection, it is very easy to make an ADO.Net connection as the connection string is exactly the same. Then you just have to reuse it.

Here is a sample that supposed that the object ServerConn is an SMO ServerConnection.

SqlConnection mySQLConnection;

 

mySQLConnection =

new SqlConnection(ServerConn.ConnectionString);

mySQLConnection.Open();