Query MySQL database in ASP

DETAILS

<%

Dim cnnSimple  ' ADO connection
Dim rstSimple  ' ADO recordset
Set cnnSimple = Server.CreateObject("ADODB.Connection")

' DSN
cnnSimple.Open "DSN=<username>_mysqlConn;"

Set rstSimple = cnnSimple.Execute("SELECT * FROM tblTest")


%>
<P> Connecting to mySQL DB with ODBC DSN </P>

<table border="1">
<%
Do While Not rstSimple.EOF
 %>
 <tr>
  <td><%= rstSimple.Fields("id").Value %></td>
  <td><%= rstSimple.Fields("name").Value %></td>
 </tr>
 <%
 rstSimple.MoveNext
Loop
%>
</table>
<%
' Close our recordset and connection and dispose of the objects rstSimple.Close Set rstSimple = Nothing cnnSimple.Close Set cnnSimple = Nothing

cnnSimple.close
%>

  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

Send mail using CDO

DETAILS<% set objMessage = createobject("cdo.message")set objConfig =...

Query MS Access Database in PHP

DETAILSBelow is a simple PHP script to demonstrate how to connect to a MS Access database using...

Redirect a subdomain to a subdirectory

DETAILS You can redirect a subdomain to a subdirectory by using ASP or ASP.net...

Send Email in ASP.NET

DETAILS<%@ Page Language="VB" %><script...

Insert data into a MS SQL database with .NET SQL Data Provider in ASP.NET

 DETAILS  <%@ import namespace="system.data.sqlclient" %><Script...