简体   繁体   English

设置linq db连接字符串

[英]Setting up linq db connection string

I created a connection using the server explorer, and dragged my entire database over (all tables) to the designer. 我使用服务器资源管理器创建了一个连接,并将整个数据库拖到了(所有表)设计器上。

I want linq to use my connection string in the web.config when I deploy it, how do I make it do this instead of using the connection string created in the server explorer? 我希望linq在部署它时在web.config中使用我的连接字符串,我该如何做到这一点而不是使用在服务器资源管理器中创建的连接字符串?

YourContextClass context = new YourContextClass(ConfigurationManager.ConnectionStrings["yourconectionstringid"].ConnectionString);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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