ASP several database connection way <%
' If you use the Foreign home page space, use the following statement: '
' Rem codepage= ' 936 '
Sqlkai=0
Dim Sqldatabasename,sqlpassword,sqlusername,sqllocalname
Sqllocalname= "(local)"
Sqlusername= "Nntoa"
Sqlpassword= "123456"
Sqldatabasename= "Sqloa"
Dim conn
Dim connstr
Dim db
' Change database name '
If db= "" then db= "Database Path"
' On Error Resume Next
Set conn = Server.CreateObject ("ADODB. Connection ")
If Err Then
Err.Clear
Response.Write ("<BR><li> operation failed, cannot create database Object!") ")
Response.End
End If
' If Sqlkai=1 then
' ConnStr = ' Provider = SQLOLEDB; User ID = "& Sqlusername &"; Password = "& SQLPassword &"; Initial Catalog = "& Sqldatabasename &"; Data Source = "& Sqllocalname &";
' Else
' connstr= ' Provider=Microsoft.Jet.OLEDB.4.0;Data source= ' & Server.MapPath ("&db&" ") &"; Jet oledb:database password= "&nt80acmi&"
' End If
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath (DB)
Conn. Open ConnStr
If Err Then
Err.Clear
Response.Write ("<BR><li> operation failed, unable to create database connection!") ")
Response.End
End If
function Connclose ' Close database
Conn.close
Set conn = Nothing
End Function
%>