1、新建txt文件,更改后缀名为udl
2、右击,以OLE DB Core Services 方式打开
3、填写相应的服务器名、登陆方式、数据源
4、以txt方式打开文件,连接字符串已经生成了,怎么样,给力吧
[oledb]
; Everything after this line is an OLE DB
initstring
Provider=SQLOLEDB.1;Password=123456;Persist Security
Info=True;User ID=sa;Initial Catalog=DyanmsoftWebsite;Data
Source=YYGY\SQLEXPRESS
5、写入项目配置文件
<add key="SQLConnectionString" value="Persist Security Info=False;User ID=sa;Password=123456;Initial Catalog=DyanmsoftWebsite;Data Source=YYGY\SQLEXPRESS"></add>
原文:http://www.cnblogs.com/varcom/p/3776715.html