SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL sonnection question with typed dataset.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

terrence_chan99
Starting Member

12 Posts

Posted - 05/04/2006 :  22:04:12  Show Profile  Reply with Quote
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!

jen
Flowing Fount of Yak Knowledge

Sweden
4110 Posts

Posted - 05/04/2006 :  22:07:54  Show Profile  Send jen a Yahoo! Message  Reply with Quote
you can check by verifying the status of the connection
not really familiar yet with vs2005

if it's connected, then you can close it
open the 2nd connection



--------------------
keeping it simple...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000