ASP and MySQL database connection method and instance code

Source: Internet
Author: User

MySQL is a small and medium website perfect database solution. If your backend MySQL database is as well as the proper structure optimization and it can be for thousands of visitors every day will not degrade server performance. In this article, I will show you how to connect to MySQL from the ASP database. You must install the MySQL ODBC driver, MYODBC 3.51 If you are not on your server yet.

<%
Dim sconnection, objconn, objRS

Sconnection = "Driver={mysql ODBC 3.51 DRIVER}; Server=localhost; database=your_mysql_db; Uid=mysql_username; Password=mysql_password; Option=3 "

Set objconn = Server.CreateObject ("ADODB. Connection ")

objConn.Open (sconnection)

Set objRS = objConn.Execute ("Select FirstName, LastName from Tblusers")


While Not objrs.eof
Response.Write Objrs.fields ("LastName") & "," & Objrs.fields ("FirstName") & "<br>"
Response.Write & ""
Objrs.movenext
Wend

Objrs.close
Set objRS = Nothing
Objconn.close
Set objconn = Nothing
%>

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.