Match ASP with MySQL

Source: Internet
Author: User
Tags mysql host

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
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.