Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of ASP connecting to MySQL Database (to be transferred)

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Method for ASP to connect to MySQL database (transfer) [@ more@] <%

'Test reads the contents of the MySql database

Strconnection= "driver= {mysql odbc 3.51 driver}; database=weste_net;server=localhost;uid=root;password="

'no need to configure dsn

Set adodataconn = server.createobject ("adodb.connection")

Adodataconn.open strconnection

Strquery = "select * from News"

Set rs = adodataconn.execute (strquery)

If not rs.bof then

% >

< table >

< tr >

< td < b > Serial number < / b > < / td >

< td > < b > title < / b > < / td >

< / tr >

<%

Do while not rs.eof

% >

< tr >

< td > <% = rs ("News_id") > < / td >

< td > <% = rs ("News_Title") > < / td >

< / tr >

<%

Rs.movenext

Loop

% >

< / table >

<%

Else

Response.write ("No data.")

End if

Rs.close

Adodataconn.close

Set adodataconn = nothing

Set rsemaildata = nothing

% >

PS: if you want to use the above code directly, replace the full-width symbol "< >" with a half-width symbol.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report