Web Hosting
e-commerce hosting

Coldfusion Hostingecommerce hosting shopping cart solution

shopping cart hosting   
 
 


  Connecting to an MS SQL Database Using File DSN ASP/ADO

This example describes using ASP/ADO to connect to a Microsoft SQL Server Database.

<%

'Sample Database Connection Syntax for ASP and SQL Server.

Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "whsql01.mesa1.secureserver.net"
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

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