Web Hosting
e-commerce hosting

Coldfusion Hostingecommerce hosting shopping cart solution

shopping cart hosting   
 
 


  Connecting to an MySQL Database Using File DSN ASP/ADO

This example describes using File DSN and ASP/ADO to connect to a MySQL Database.

<%
Dim oConn, oRs
Dim qry, connectstr, sDSNDir
Dim db_name, db_username, db_userpassword
Dim db_server, dsn_name

dsn_name = "your_dsn_name"
fieldname = "your_fieldname"
tablename = "your_tablename"

sDSNDir = Server.MapPath("_dsn")

connectstr = "filedsn=" & sDSNDir & "\" & dsn_name

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
"
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>

 

     

ecommerce hostingcold fusion hosting

All use of this Web site is subject to the Terms of Service.
©1997-2010 Infinities eCommerce Web Hosting and Shopping Cart Solution.


PHP Hosting  | MySQL Hosting | Shopping Cart Demo | ColdFusion Hosting | Ecommerce Hosting

Live Chat by Comm100