发新话题
打印

[转帖] ASP新建空ACCESS数据库

ASP新建空ACCESS数据库

<%
Dim sDataName,oFso, oCat
sDataName = "data/mdb.mdb"
Set oFso = Server.CreateObject("Scripting.FileSystemObject")
    If Not oFso.FileExists(Server.MapPath(sDataName)) Then    '检查数据库是否存在
        '创建数据库文件
        Set oCat = Server.CreateObject("ADOX.Catalog")
            oCat.Create "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Server.MapPath(sDataName)
        Set oCat = Nothing
        Response.Write "创建成功!"
    Else
        Response.Write "已经存在!"
    End If
Set oFso = Nothing
%>

来源:http://bbs.blueidea.com/thread-2858104-1-1.html

TOP

发新话题