The following is the SQL connection code:
Copy Code code as follows:
Function Open_conn ()
Dim conn,strconn
Set Conn=server.createobject ("Adodb.connection")
strconn = "Provider = SQLOLEDB; User ID = database login account; Password = database login password; Initial Catalog = database name; Data Source = (local);
Conn.Open strconn
Set Open_conn=conn
If ERR Then
Err. Clear
Conn.close:set conn=nothing
Response.Write "Sorry, there was an error in the database connection. "
Response.End
End If
End Function
Call Method:
will be the original
Copy Code code as follows:
Change into
Copy Code code as follows:
The following is the Access connection code:
Copy Code code as follows:
Function Open_conn ()
Dim dbpath,conn
Dbpath=server. MapPath ("Database Path")
Set Conn=server.createobject ("Adodb.connection")
Conn.Open "Data source=" &dbpath& ";p rovider=microsoft. jet.oledb.4.0; "
Set Open_conn=conn
If ERR Then
Err. Clear
Conn.close:set conn=nothing
Response.Write "Sorry, there was an error in the database connection. "
Response.End
End If
End Function
Call Method:
will be the original
Copy Code code as follows:
Change into
Copy Code code as follows: