You really want to use DSN-less connections. Your code will be portable.
But, to use your DSN connection you would do the following:
<%
dim cn
set cn = Server.CreateObject("ADODB.Connection")
cn.ConnectionString = "DSN=mail.dsn"
cn.Open
if cn.State <> 1 then
Response.Write "Could not connect to database"
else
Response.Write "Connected!!"
end if
cn.Close
set cn = nothing
%>
On 3/28/05 2:02 PM, in article
96******************************@SQLMonster.com, "Chad Benjamin via
SQLMonster.com" <fo***@SQLMonster.com> wrote:
Hello,
Im brand new and trying to learn SQL Server 2000, I have purchased a book
and been reading it for a few weeks.
I'm tring to find an ASP script that would let me know if my connection to
my database is working.
I use DSN, i created a DSN name "mail"
anyone have any scripts?