Home - Help & Support - Contact Us
    

Connecting To A MySQL Database Using ASP Or ADO

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

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

db_server = "mysql.secureserver.net"
db_name = "your_dbusername"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={MySQL ODBC 3.51 Driver};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) & "<br>"
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>
Rated:NR/0 Votes
674 Views
More Articles From ASP
More Articles From ASP
Print Article
Print
Share |
Comments, Questions & Reviews
#1 Comment by: www.webng.com/
2009-03-07 03:48:28
 
Nice article very helpul



Comments is currently disabled for this article!
Related Articles and Readings
Connecting to a MySQL Database on Your Linux Hosting
This example describes using PHP to connect to a MySQL Database on a Linux hosting account. <?php//Sample Database Connection Syntax for ...
Pointing Your Domain Name to a Third Party Host Companys Servers
In order for a domain name to work with any hosting account, the domain name's DNS (Domain Name Servers) must ...
Changing Your User Name
To Change Your User Name Click Settings. Go to the Account Settings tab. Click the Edit hyperlink for your user name. ...
What is DNS?
Your DNS or Domain Name Server is the system that allows your web site to be displayed when the user ...
Uniform Domain Name Dispute Resolution Policy
Uniform Domain Name Dispute Resolution Policy (As Approved by ICANN on October 24, 1999) 1. purpose This Uniform Domain Name Dispute Resolution ...
The information provided in this article is for general information and/or the comments is the sole responsibility of their respective authors and does not necessarily reflect the opinion of zeronese.net does not endorse any article and/or comments published by our web users unless otherwise noted.