首页 > 数据库技术 > 详细

SQL Server连接字符串

时间:2017-03-02 21:48:06      阅读:207      评论:0      收藏:0      [点我收藏+]
//windows身份验证1
            //string strCon = @"Data Source=.\sqlexpress;Initial Catalog=db1;Integrated Security=True;Pooling=False";
            
            //windows身份验证2
            //string strCon = @"server=.\sqlexpress;database=db1;Integrated Security=True;";

            //Sql Server身份验证1
            //string strCon = @"server=.\sqlexpress;database=db1;uid=sa;pwd=123456";

            //Sql Server身份验证2
            //string strCon = @"Data Source=.\sqlexpress;Initial Catalog=db1;User ID=sa;Password=123456;Pooling=False";

            /*
             从配置文件中读连接字符串
             在<configuration>标记中加上
             <connectionStrings>
                <add name="strCon" connectionString="server=.\sqlexpress;database=db1;uid=sa;pwd=123456"/> 
             </connectionStrings>
            */
            string strCon = ConfigurationManager.ConnectionStrings["strCon"].ConnectionString;

 

SQL Server连接字符串

原文:http://www.cnblogs.com/beast-king/p/6492477.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!