2011-06-01 166 views
2

我使用下面的连接字符串连接到位于另一台服务器上的sqlserver 2008。 如何使用vbscript从ASP连接到它?连接字符串连接到另一台服务器上的sql server 2008

application("database_connectionstring_internal") = "DRIVER=SQL Server;SERVER=53.90.111.22;DATABASE=crm_cos;UID=cos_user;PASSWORD=1q2w3e4r5t" 

这里是我的服务器的详细信息:

数据库服务器: 服务器IP - 53.90.111.22

SQL Server名称 - SCD13B

用户名 - cos_user

密码 - 1q2w3e4r5t

Dat ABASE名字 - crm_user

+0

怎么办你连接到它**使用哪种技术**? .Net,C++,Java等? – 2011-06-01 06:36:19

+2

请告诉我你的密码不是你写的那个密码......不要发布密码!!! – Marco 2011-06-01 06:37:54

+0

@将A,我使用asp与vbscript – Anuya 2011-06-01 06:38:11

回答

0

我使用的是这样的:

C#

"Data Source=host's ip\\SQLEXPRESS;Initial Catalog=yourddbb;User ID=youruser;Password=yourpassword" 

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" 
0

你有两种可能性:

1 - 连接字符串添加到您的web.config的节目在这个岗位:"Using connection strings from web.config in ASP.NET v2.0"

2 - 添加连接到后台代码:

Dim strConnect As String=”Data Source=localhost;Initial Catalog=pubs;Integrated Security=SSPI;” 

Dim myConnection As SqlConnection=New SqlConnection(strConnect) 

MyConnection.Open() 
+0

由于OP没有使用.net,所以这没有帮助 – jmoreno 2011-06-03 07:57:47

1

尝试 -

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"