I’m working with an object that has a connection to the Database in the form of DBCommand.Connection, and another object that takes a connection to the database in the form of SQLConnection.
Persist security is Off so I can’t create a new SQLConnection since the password is stripped, any ideas of how I can do this?
If i understand your question correctly, you’re asking how to cast the
DbCommand.Connectionproperty (which is of typeDbConnection) to aSqlConnection.Since
SqlConnectioninherits ofDbConnectionyou can simply cast it accordingly:Of course this assumes that the
DbConnectionis actually aSqlConnection.