Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
terrence_chan99
Starting Member
12 Posts |
Posted - 2006-05-04 : 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 Settingsi.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"; QuestionsI 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! |
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-05-04 : 22:07:54
|
you can check by verifying the status of the connectionnot really familiar yet with vs2005if it's connected, then you can close itopen the 2nd connection--------------------keeping it simple... |
|
|
|
|
|