Asp.Net和MSSQL数据库连接 [英] Asp.Net and MSSQL database connection

查看:140
本文介绍了Asp.Net和MSSQL数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以将ASP.NET Web应用程序(位于服务器上)与loaclhost MSSQL数据库(在Windows Management Studio 2008 R2中运行)连接?连接字符串应该是什么?谢谢

Hi,
is it possible to connect ASP.NET web application (which is on the server) with loaclhost MSSQL database (run in Windows Management Studio 2008 R2)? What should be the connection string? Thanks

推荐答案

让我先了解你的具体要求是什么?



ASP.NET应用程序在Web服务器。

SQL Server在同一台服务器上。



您可以使用服务器中安装的sql server实例进行连接。



标准安全

Let me first understand what is your exact requirement?

ASP.NET app is in web server.
SQL Server is in the same server.

You can connect using sql server instance installed in the server.

Standard Security
Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;





可信连接

Server = myServerAddress; Database = myDataBase; Trusted_Connection = True;



使用Sql Server实例



Trusted Connection
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

using Sql Server Instance

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
Password=myPassword;







现在,如果你的sql服务器存在于不同的服务器中

使用IP地址连接



数据源= 190.190.200.100,1433;网络库= DBMSSOCN;

初始目录= myDataBase;用户ID = myUsername;密码= myPassword;





现在,如果你的机器中存在sql server -

连接的场景是荒谬的



希望这会有所帮助!

干杯




Now, if your sql server exists in a different server
Connect using IP address

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;


Now, if your sql server exists in your machine -
the scenario to connect is absurd

Hope this helps!
Cheers


这篇关于Asp.Net和MSSQL数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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