Function Open_conn()
dim Dbpath,Conn
Dbpath=("Database Path")
set Conn=("")
"data source="&dbpath&";provider=.4.0;"
set Open_conn=Conn
If Err Then
:set Conn=nothing
"Sorry, there was an error in the database connection."
End If
End Function
Call method:
Put the original
sql,conn
Change to
sql,Open_conn()
By the way, provide an old code that can share ACCESS database across sites on the same server. Maybe some friends can use it:
Sometimes, we have many secondary domain names, and we may need to make these secondary domain names call a certain ACCESS database. If you are unwilling to use SQL databases, the following methods can be used for database connection. (Special tip: If your server has FSO security permissions, you need to set this database directory to allow IIS users of each station you need to call to have access to modifications.)
The following database physical path is similar to E:\directory\directory\database name
dim Conn,Strconn
Set Conn = ("")
Strconn="Provider = .4.0; "
Strconn=Strconn & "Data Source=Database physical path"
Strconn
If Err Then
:set Conn=nothing
"Sorry, there was an error in the database connection."
End If