ASP与ACCESS连接

连接数据库
法一:

1
2
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("data.mdb此为数据库名")

法二:

1
2
3
4
5
dim db,conn,myconn
db="data.mdb此为数据库名"
Set Conn = Server.CreateObject("ADODB.Connection")
myconn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Conn.Open MyConn

关闭连接

1
2
conn.Close
Set conn = Nothing