Match ASP with MySQL
Required tools
Mysql-4.1.11-win32
Myodbc-3.51.11-1-dll
Myodbc-3.51.11-1-win
Mysqlcc-0.9.4-win32
-------------------------------------------------------------------
Register the file mydbc. Reg
Regedit4
[HKEY_LOCAL_MACHINE \ SOFTWARE \ ODBC \ odbcinst. ini \ myodbc driver]
"Usagecount" = DWORD: 00000002
"Driver" = "C: \ Windows \ System \ myodbc. dll"
"Setup" = "C: \ WINDOWS \ SYSTEM \ myodbc. dll"
"Sqllevel" = "1"
"Fileusage" = "0"
"Driverodbcver" = "03.51"
"Connectfunctions" = "yyy"
"Apilevel" = "1"
"Cptimeout" = "120"
[HKEY_LOCAL_MACHINE \ SOFTWARE \ ODBC \ odbcinst. ini \ ODBC drivers]
"Myodbc driver" = "installed"
-------------------------------------------------------------------
Create an ASP file link database
Example:
Windows DSN name: name of the DSN to be created
MySQL host (name or IP): The name or IP address of the MySQL server.
MySQL Database Name: Admin
Database: Admin
Password: 000000
Port (otherwise not 3306 ):
SQL command on CONNECT:
ASPCode
1. Use DSN
<%
Strconnection = "DSN = admin; driver = {mydbd driver}; server = localhost; uid = root; Pwd = 000000; database = admin"
Set adodataconn = server. Createobject ("ADODB. Connection ")
Adodataconn. Open strconnection
Strquery = "select * from user"
Set rs = adodataconn. Execute (strquery)
If not Rs. bof then
%>
<Table>
<Tr>
<TD <B> username </B> </TD>
<TD> <B> password </B> </TD>
</Tr>
<%
Do while not Rs. EOF
%>
<Tr>
<TD> <% = RS ("username") %> </TD>
<TD> <% = RS ("password") %> </TD>
</Tr>
<%
Rs. movenext
Loop
%>
</Table>
<%
Else
Response. Write ("sorry, no data found .")
End if
Rs. Close
Adodataconn. Close
Set adodataconn = nothing
Set rsemaildata = nothing
%>
2. Do not use DSN
<%
Strconnection = "defaultdir =; driver = {myodbc driver}; database = admin"
Set adodataconn = server. Createobject ("ADODB. Connection ")
Adodataconn. Open strconnection
Strquery = "select * from user"
Set rs = adodataconn. Execute (strquery)
If not Rs. bof then
%>
<Table>
<Tr>
<TD <B> username </B> </TD>
<TD> <B> password </B> </TD>
</Tr>
<%
Do while not Rs. EOF
%>
<Tr>
<TD> <% = RS ("username") %> </TD>
<TD> <% = RS ("password") %> </TD>
</Tr>
<%
Rs. movenext
Loop
%>
</Table>
<%
Else
Response. Write ("sorry, no data found .")
End if
Rs. Close
Adodataconn. Close
Set adodataconn = nothing
Set rsemaildata = nothing
%>