Displaying Source Code(s)
|
|
--------------------------------------------------------------------------------
Connection Info
--------------------------------------------------------------------------------
Description : If you want to know what drivers and other vital
details are being used for a DSN, here is some code to the
rescue.
html><head>
<title>connectioninfo.asp by Christophe Wille http://www.softwing.com</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
%>
|
|
|