[英]Connection string to connect sql server 2008 which is in another server
I use the below connection string to connect to a sqlserver 2008 located in another server.我使用以下连接字符串连接到位于另一台服务器中的 sqlserver 2008。 How to i connect to it from ASP using vbscript?
如何使用 vbscript 从 ASP 连接到它?
application("database_connectionstring_internal") = "DRIVER=SQL Server;SERVER=53.90.111.22;DATABASE=crm_cos;UID=cos_user;PASSWORD=1q2w3e4r5t"
Here are my server details:这是我的服务器详细信息:
Database server: Server IP - 53.90.111.22数据库服务器:服务器 IP - 53.90.111.22
Sql server name - SCD13B Sql 服务器名称 - SCD13B
User name - cos_user用户名 - cos_user
password - 1q2w3e4r5t密码 - 1q2w3e4r5t
Database name - crm_user数据库名称 - crm_user
Try --尝试 -
Dim oConn
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Driver={SQL Server};Server=53.90.111.22;Database=crm_user;Uid=cos_user;Pwd=1q2w3e4r5t"
I am using something like this:我正在使用这样的东西:
C# C#
"Data Source=host's ip\\SQLEXPRESS;Initial Catalog=yourddbb;User ID=youruser;Password=yourpassword"
ASP 3.0 ASP 3.0
StrConex= ""
StrConex= StrConex & "Provider=SQLOLEDB.1;Password=yourpasswd;"
StrConex= StrConex & "Persist Security Info=True;User ID=youruser;"
StrConex= StrConex & "Initial Catalog=yourddbb;Data Source=host's ip\SQLEXPRESS"
You have two possibilities:你有两种可能:
1 - Add connection string to your web.config as show in this post: "Using connection strings from web.config in ASP.NET v2.0" 1 - 将连接字符串添加到 web.config 中,如本文所示: “在 ASP.NET v2.0 中使用 web.config 中的连接字符串”
2 -Add the connection to code-behind: 2 - 将连接添加到代码隐藏:
Dim strConnect As String=”Data Source=localhost;Initial Catalog=pubs;Integrated Security=SSPI;”
Dim myConnection As SqlConnection=New SqlConnection(strConnect)
MyConnection.Open()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.