且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

c#中的sql连接字符串

更新时间:2023-11-06 22:45:10

你可以得到连接字符串按照以下方式...

1.在你的桌面上创建test.udl文件。

2.打开该文件

3.选择你的服务器名称

4.选择你的数据库

5。点击测试连接(如果成功)

6.点击完成。

7.用wordpad / notepad打开同一个文件

8。添加用户名和密码(如果你使用服务器authontication)

复制连接字符串并将其配置为你的配置文件

喜欢



you can get connection string in following way also...
1. create test.udl file on ur desktop.
2. open that file
3. select ur sever name
4. select ur database
5. click on test connection (if its succeded)
6. click on finish.
7. open same file with wordpad/ notepad
8. add username and password(if you are using server authontication)
copy the connection string and pest it your config file
like

<connectionStrings>
   <add name="ApplicationServices" connectionString="copy connection string here" 

    />
 </connectionStrings>


我在连接字符串中看不到用户名密码。请参阅本网站

http://www.connectionstrings.com/sql-server-2008 [ ^ ]
I dont see the user name password in the connection string. Refer this website
http://www.connectionstrings.com/sql-server-2008[^]


static string ConStr = "Data Source=ADMIN-B19C3BADF;Initial Catalog=bazarkhodro;Integrated Security=True";
SqlConnection con = new SqlConnection(ConStr);