简体   繁体   中英

Connection string for C# ASP.NET for SQL

I was wondering if are you able to have two connection strings for two different databases from one SQL Server in one page, for ASP.NET, using C# and Visual Studio.

Any advise would be helpful, thank you!

yes, is the answer of course you can. Just put both connection strings in the respective config files and switch on them as appropriate. If i was you i would perhaps write some kind of helper class that just allows you to pass in the connection string name. Or you could just use the standard ConfigurationManager API to interact with the config files that way.

But without anything more specific in terms of code samples that's about all the advice i can offer up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM