|
terrence_chan99
Starting Member
12 Posts |
Posted - 05/04/2006 : 22:04:12
|
I have a question about the SQL connection.
I am using VS2005 and SQL2005.
I create a "Data Connection" using trusted connection when I set up a Typed Dataset.
So the connection string is auto-generated and store in the Solution Properties Settings
i.e.
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=SERVERNAME;Initial Catalog=MyApplication;Integrated Security=True;Application Name=\"APPLICTIONNAME\"")]
public string MyApplicationConnectionString {
get {
return ((string)(this["MyApplicationConnectionString"]));
}
}
I have a login screen which capture the username and password to make a connection string,
i.e.
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "data source=localhost;initial catalog=MyApplication" +
";User Id=" + strName + ";Password=" + strPassword +
";Application Name=MyApplication";
Questions
I want the retrieve of all data are using this 2nd connection string instead of MyApplicationConnectionString.
As you see I have two connection strings. I wonder at the run-time, what connectionstring will the typed dataset use? I assume it will be the "MyApplicationConnectionString", if so, how I can force is to use the second connectionstring(conn)?
Thanks!
|
|