Classic ASP SQL Server Database Connection

2020-07-13 10:31发布

问题:

I am aiming to create a very basic web based DBMS for Microsoft SQL Server. However, in order to connect to a SQL Server database you seem to require a ODBC connection on the server. Is there any possible way to overcome this?

回答1:

You haven't stated which version of SQLServer but you can use OLEDB connection in ASP.

<%

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")

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

%>