问题描述
|
我使用以下连接字符串连接到位于另一台服务器上的sqlserver 2008。
我如何使用vbscript从ASP连接到它?
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服务器名称-SCD13B
用户名-cos_user
密码-1q2w3e4r5t
数据库名称-crm_user
解决方法
我正在使用这样的东西:
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\"
, 尝试-
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\"
, 您有两种可能性:
1-如本文中所示,将连接字符串添加到您的web.config中:\“在ASP.NET v2.0中使用来自web.config的连接字符串\”
2-将连接添加到后台代码:
Dim strConnect As String=”Data Source=localhost;Initial Catalog=pubs;Integrated Security=SSPI;”
Dim myConnection As SqlConnection=New SqlConnection(strConnect)
MyConnection.Open()