For giving you perfect idea on how to work with DSN I am giving you full source code which you can use in your application but be sure that code is written for ASP.
To start coding using asp first of all you have to declare Scriplet tag which is the first line of ASP coding which you can see below
<%
set objcon=server.CreateObject("ADODB.Connection")
objcon.ConnectionTimeout=60
objcon.Open "DSN=dsnname"
Set RS2 = Server.CreateObject("Adodb.RecordSet")
rs2.ActiveConnection=objcon
rs2.LockType=1
rs2.CursorLocation=3
rs2.CursorType =1
query="select nm from Table"
rs2.open query
if rs2.recordcount > 0 then
do while not rs2.eof
Variable = rs2("fieldname")
response.Write(id)
rs2.movenext
loop
end if
rs2.close
Don't forget to write below given lines
objcon.Close
Set objcon=Nothing
%>
To start coding using asp first of all you have to declare Scriplet tag which is the first line of ASP coding which you can see below
<%
set objcon=server.CreateObject("ADODB.Connection")
objcon.ConnectionTimeout=60
objcon.Open "DSN=dsnname"
Set RS2 = Server.CreateObject("Adodb.RecordSet")
rs2.ActiveConnection=objcon
rs2.LockType=1
rs2.CursorLocation=3
rs2.CursorType =1
query="select nm from Table"
rs2.open query
if rs2.recordcount > 0 then
do while not rs2.eof
Variable = rs2("fieldname")
response.Write(id)
rs2.movenext
loop
end if
rs2.close
Don't forget to write below given lines
objcon.Close
Set objcon=Nothing
%>