略過並前往主要內容
致電我們
  • 香港 服務時間:9:00~18:00 周一至周五3018 8600
服務專線和服務時間
預約回電

無須線上等候,提交預約我們將儘快回電。

預約回電
說明中心

瀏覽我們線上說明資源

說明

Windows Hosting (Plesk) 說明

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

%>

相關社群

mikeb1's Avatar
Connecting to mySQL database

5 回覆

Last posted about 1 year ago.

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

1 回覆

Last posted about 4 years ago.

overkill452's Avatar
Connecting to a Remote MySQL Database

21 回覆

Last posted about 3 years ago.

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

2 回覆

Last posted about 3 years ago.

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

8 回覆

Last posted over 4 years ago.

找不到主題嗎?搜尋社群