如何在.net应用程序中使用安装在本地网络中的Sql Server? [英] How Can one use Sql Server installed in local network in .net applications?

查看:96
本文介绍了如何在.net应用程序中使用安装在本地网络中的Sql Server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个.net应用程序,它使用数据库作为其数据源.
我有一个SQL Server 2008(将要安装)的副本,我想知道如何确定我的连接字符串(ADO.net):
SQL服务器将安装在由5台计算机组成的网络中的一台计算机(服务器)上. 4个客户端计算机将需要访问服务器以进行数据查询,并且还需要将简单文件上传到服务器目录.

Hello people,
I have a .net application which uses a database for its data source.
I have a copy of SQL Server 2008(to be installed) and i would like to know how i can determine my connection string(ADO.net):
the SQL server will be installed on one machine(server) in a network of 5 machines. the 4 client machines will need to access the server for data queries and also to upload simple files to the server directory.

推荐答案

http://www.connectionstrings.com/ [ ^ ]


检查此站点,它们具有几乎所有数据库的示例连接字符串.
http://www.codemaker.co.uk/it/tips/ado_conn.htm [ ^ ]
Check this site, they have sample connection strings for almost all the databases.
http://www.codemaker.co.uk/it/tips/ado_conn.htm[^]


安装Sqlserver
安装询问命名实例还是默认实例
命名实例的连接字符串将为
Install the Sqlserver
installation ask for named instance or default instance
for named instance connection string will be
string strSql = @"server=ServerName\SqlInstanceName;uid=sa;password=SqlPassword;database=DbName";


默认实例的连接字符串将为


for default instance connection string will be

string strSql = @"server=ServerName\SqlInstanceName;uid=sa;password=SqlPassword;database=DbName";

SqlConnection cn = new SqlConnection(strSql);




ServerName =安装了SQL Server的服务器
SqlInstanceName = SQL服务器实例
SqlPassword =安装时给出的sql服务器密码
DbName =应用程序将要连接到的数据库名称.




ServerName = server on which sql server is installed
SqlInstanceName = sql server instance
SqlPassword = sql server password given at installation time
DbName = database name to which application is going to be connected.


这篇关于如何在.net应用程序中使用安装在本地网络中的Sql Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆