View Single Post

   
  #3 (permalink)  
Old 02-29-2008, 07:50 AM
Gregory Dean
 
Posts: n/a
Default Re: Sample ASP Script??

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
96fc54d1d15b43f3ab5b707ecee86301@SQLMonster.com, "Chad Benjamin via
SQLMonster.com" <forum@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?


Reply With Quote