programming-examples/asp/Sessions_SQL/Connection Info.asp
2019-11-18 14:25:58 +01:00

55 lines
1.8 KiB
Plaintext

<html><head>
<title>Document</title>
</head>
<!--#include file="lib_connectioninfo.asp"-->
<body>
<%
Response.Write "<hr>SQL Server Connection"
Call DSNinfo("DSN=student;uid=student;pwd=magic")
Response.Write "<hr>Access Connection Connection"
theDSN="DRIVER={Microsoft Access Driver (*.mdb)};DBQ="
theDSN=theDSN & Server.MapPath("/learn/test/biblio.mdb")
Call DSNInfo(theDSN)
%>
</body>
</html>
The Include file looks like this:
<%
Sub DSNInfo(strDSN)
Set cnn1 = Server.CreateObject("ADODB.Connection")
Set rsQuery = Server.CreateObject("ADODB.RecordSet")
cnn1.open strDSN
Response.Write "ADO Version: " & cnn1.Version
Response.Write "<BR>" & vbCrLf
Response.Write strVersionInfo & "DBMS Name: " & cnn1.Properties("DBMS Name")
Response.Write "<BR>" & vbCrLf
Response.Write "DBMS Version: " & cnn1.Properties("DBMS Version")
Response.Write "<BR>" & vbCrLf
Response.Write "OLE DB Version: " & cnn1.Properties("OLE DB Version")
Response.Write "<BR>" & vbCrLf
Response.Write "Provider Name: " & cnn1.Properties("Provider Name")
Response.Write "<BR>" & vbCrLf
Response.Write "Provider Version: " & cnn1.Properties("Provider Version")
Response.Write "<BR>" & vbCrLf
Response.Write "Provider Friendly Name: " & cnn1.Properties("Provider Friendly Name")
Response.Write "<BR>" & vbCrLf
If 0 = InStr(LCase(cnn1.Properties("Provider Name")),"oledb") Then
' ### no OLE DB Provider used, therefore :
Response.Write "Driver Name: " & cnn1.Properties("Driver Name")
Response.Write "<BR>" & vbCrLf
Response.Write "Driver Version: " & cnn1.Properties("Driver Version")
Response.Write "<BR>" & vbCrLf
Response.Write "Driver ODBC Version: " & cnn1.Properties("Driver ODBC Version")
Response.Write "<BR><BR>"
End If
Set rsQuery = Nothing
Set cnn1 = Nothing
End Sub
%>