Passer au contenu principal
Maintenez vos activités pendant le COVID-19En savoir plus
Contactez-nous
Numéros de téléphone et heures
Centre d’aide

Explorez nos ressources d’aide en ligne

Aide

Windows Hosting (Plesk) Aide

Connecting to a MySQL Database Using ASP/ADO

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

Replace values beginning with your_ with your databases information. Replace mysql.secureserver.net with the database hostname.

<%
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) & "
"
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>

Rubriques relatives à la communauté

mikeb1's Avatar
Connecting to mySQL database

5 Réponses

Last posted about 1 year ago.

kerryww's Avatar
Trouble connecting MySql Database from an ASP script

1 Réponses

Last posted about 4 years ago.

overkill452's Avatar
Connecting to a Remote MySQL Database

21 Réponses

Last posted about 3 years ago.

bennyboy's Avatar
Setting up ASP Schema for MSSQL Database in Plesk

2 Réponses

Last posted about 3 years ago.

BetoFia's Avatar
Connecting to a MySQL database with a form.

8 Réponses

Last posted over 4 years ago.

Vous ne voyez pas ce que vous recherchez ? Effectuez une recherche dans la communauté