简体   繁体   中英

Connect to SQL server (Windows Authentication) via Classic ASP

hey, I wanna connect to sql with windows Authentication either sql server authentication but frankly i can't :

this is my connection string :

<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
'conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = Northwind; User Id=Mohammad-PC/Mohammad; Password="
conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = Northwind; User Id=sa; Password="
If conn.errors.count = 0 Then
Response.Write "Connected OK"
End If
%>

and i get this error :

Microsoft OLE DB Provider for SQL Server: Login timeout expired

i've set session timeout to 10mins but still same. i use IIS 7.5 and sql server 2005

The msdn-support gives a couple of hints, mostly about the firewall configuration and the port the database engine listens to which might not be the standard 1433 due to security issues.
Try adding the port number to the Data Source, sth like:

Provider=SQLOLEDB; Data Source = (local),[port]; Initial Catalog = Northwind; User Id=sa; Password=[password]"



Have a look here:
Solving 'Login timeout expired' Problem

(local)

is probably not getting resolved. Try localhost or even 127.0.0.1

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM