I use the below connection string to connect to a sqlserver 2008 located in another server. How to i connect to it from ASP using vbscript?
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
Sql server name - SCD13B
User name - cos_user
password - 1q2w3e4r5t
Database name - 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#
"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"
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"
2 -Add the connection to code-behind:
Dim strConnect As String=”Data Source=localhost;Initial Catalog=pubs;Integrated Security=SSPI;”
Dim myConnection As SqlConnection=New SqlConnection(strConnect)
MyConnection.Open()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.