Procédure de connexion à une base de donnée MySQL en asp
Editer/créer le fichier
mysql.asp.
Exemple :
<html>
<body>
<p>Test Mysql</p>
<%
Dim sConnStr, oConn
sConnStr = "DRIVER={MySQL ODBC 3.51
Driver};SERVER=mysqlxxx.swisscenter.com;DATABASE=mydatabase_name;UID=my_UUID;PWD=my_password;"
Set oConn = Server.CreateOBject("ADODB.Connection")
oConn.Open sConnStr
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM my_table", oConn
Response.Write("<table>")
do until rs.EOF
Response.Write("<tr>")
for each x in rs.Fields
Response.Write("<td>" & x.value & "</td>")
next
Response.Write("</tr>")
rs.MoveNext
loop
Response.Write("</table>")
rs.Close
oConn.Close
%>
</body>
</html>
Article ID: 77, Created: 9/13/2012 at 10:43 AM, Modified: 9/13/2012 at 10:43 AM