F
Friso Wiskerke
Hi all,
In the ConnectionString property you can set the UserName and Password to be
used for the SqlConnection as well as the DataSource and Initial Catalog
(and some more possible values). There are properties on the SqlConnection
object which return the DataSource and the Database provided in the
ConnectionString but there are no such properties for the UserName and
Password.
I'm creating a class which is using DTS object to generate an Excel file and
I would only like to provide a SqlConnection object, a CommandText and a
CommandType to the class. The DTS Connection2 object has separate properties
for Datasource, Catalog, UserID and password. Now I have to provide the
UserName and Password as separate parameters to the class because I can't
derive them from the SqlConnection object.
Parsing the ConnectionString seems a bit tricky because you can provide the
username with different keywords like: "uid" or "User Id', the same goes for
password. And I don't know if there are more possible keywords.
Does anybody know a way to to achieve what I want?
TIA,
Friso Wiskerke
In the ConnectionString property you can set the UserName and Password to be
used for the SqlConnection as well as the DataSource and Initial Catalog
(and some more possible values). There are properties on the SqlConnection
object which return the DataSource and the Database provided in the
ConnectionString but there are no such properties for the UserName and
Password.
I'm creating a class which is using DTS object to generate an Excel file and
I would only like to provide a SqlConnection object, a CommandText and a
CommandType to the class. The DTS Connection2 object has separate properties
for Datasource, Catalog, UserID and password. Now I have to provide the
UserName and Password as separate parameters to the class because I can't
derive them from the SqlConnection object.
Parsing the ConnectionString seems a bit tricky because you can provide the
username with different keywords like: "uid" or "User Id', the same goes for
password. And I don't know if there are more possible keywords.
Does anybody know a way to to achieve what I want?
TIA,
Friso Wiskerke