FAQ
   manual.pipni.cz > Databáze  |  Vyhledávání  |  Problémy?

Jak se připojit k MySQL z ASP?
Velice jednoduchá ukázka jak to provést:
<%
  Response.ContentType = "text/html; charset=utf-8"
%>
<html>
  <head>
    <title>Test</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body>
  <%
    Dim Connect_URL, Connect_Username, Connect_Password
    Connect_URL = "DRIVER=com.mysql.jdbc.Driver;URL=jdbc:mysql://mysql/database?user=user&password=password"
    Connect_Username = "user"
    Connect_Password = "password"

    Dim CN, RS, Rows

    Set CN = Server.CreateObject("ADODB.Connection")
    CN.Open Connect_URL, Connect_Username, Connect_Password
    Set RS = Server.CreateObject("ADODB.RecordSet")
    RS.Open "SELECT * FROM table", CN
    Rows = RS.GetRows()
    for j = 0 to UBOUND(Rows, 2)
        Response.write(Rows(0, j))
        Response.write("<br />")
    next
    RS.Close
    CN.Close
  %>
  </body>
</html>

Celkový počet rad: 141
Created by PIPNI
Powered by Firebird