Frog frog recommendation: commonly used database connection pages in ASP
Source: Internet
Author: User
<! -- Frog recommendation: commonly used database connection pages in ASP -->
<%
Dim Conn, strconn, MMDB
'Change the Database Name
MMDB = "# test. mdb"
Set conn = server. Createobject ("ADODB. Connection ")
Strconn = "provider = Microsoft. Jet. oledb.4.0; Data Source =" & server. mappath ("" & MMDB &"")
'If your server adopts an older version of the access driver, use the following connection method:
'Strconn = "driver = {Microsoft Access Driver (*. mdb)}; DBQ =" & server. mappath ("" & MMDB &"")
'If you are using sqlserver, use the following connection method
Strconn = "driver = {SQL Server}; server = 192.168.0.110; database = Wawa; uid = sa; Pwd = sa ;"
'Response. Write (strconn) 'test statement
'Comment out on error resume next during debugging, otherwise you will not be able to see some errors.
On Error resume next
Conn. Open strconn
If err then
Err. Clear
Conn. Close
Response. write "<span style =" "font-size: 14px; font-family: verdana, Arial,; "> <p> <strong> the website is undergoing routine maintenance. Please come back later! </P> </strong> </span>"
Response. End
'Else
'Response. Write ("connection successful ")
End if
Function closedata
Conn. Close
Set conn = nothing
End Function
%>
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