标签:nec 工具 strong cli 发布 using express uid pos
原文发布时间为:2008-07-25 —— 来源于本人的百度文章 [由搬家工具导入]
1、
使用web.config中设置连接串
在web.config中<configuration>.......</configuration>之间加:(当然Connect Timeout=30可写可不写)
<appSettings>
<add key="MyConn" value="Server=.\SQLEXPRESS;Database=MyTest;uid=sa;pwd=123456;Connect Timeout=30"/>
</appSettings>
或windows认证方式:
<appSettings>
<add key="MyConn" value="Server=.\SQLEXPRESS;Database=MyTest;Integrated Security = True;Connect Timeout=30"/>
</appSettings>
在调用时,加引用
using System.Configuration;
using System.Data.SqlClient;
之后
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["MyConn"]);
2、如果不使用webconfig中的连接串,上面这句更换为:
SqlConnection myConnection = new SqlConnection("server=.\\SQLEXPRESS;database=MyTest;uid=sa;pwd=123456");
或windows认证方式:
SqlConnection myConnection = new SqlConnection("Server=.\\SQLEXPRESS;database=MyTest;Integrated Security = True");
-------------------------------------------------------------------------------------
Access:
<add key="OleDbAccess" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 'E:\xxx\xxx.mdb' "/>
Oracle:
<add key="MyOracle" value="Data Source=L2DB;User id=tpco1;Password=tpco1"/>
标签:nec 工具 strong cli 发布 using express uid pos
原文地址:http://www.cnblogs.com/handboy/p/7141588.html