In .Net is there a class in .Net where you can get the DB name, and all the connection string info without acutally doing a substring on the connection string?
EDIT:
I am not creating a connection I am attempting to get info out of the connection string. So I am basicly looking for something that takes a connection string arg and has accessors to dbName, connection type, etc….
You can use the provider-specific ConnectionStringBuilder class (within the appropriate namespace), or
System.Data.Common.DbConnectionStringBuilderto abstract the connection string object if you need to. You’d need to know the provider-specific keywords used to designate the information you’re looking for, but for a SQL Server example you could do either of these two things:Given
You could do…
Or