% Option Explicit dim databasename '定义数据库名称 databasename="cnbruce.mdb" '数据库名称 dim databasepath '定义数据库存放路径 databasepath="e:\cnbruce\database\" '数据库绝对路径 dim databasever '定义数据库版本 2000 或者 97 databasever = "2000" Function Createdfile(FilePath,FileName,Ver) Dim cnbruce,dbver select case ver case "97" dbver = "3.51" case "2000" dbver = "4.0" end select if dbver > "" then Set cnbruce = Server.CreateObject("ADOX.Catalog") call cnbruce.Create("Provider=Microsoft.Jet.OLEDB." dbver ";Data Source=" filepath filename) end if End Function Call Createdfile(databasepath,databasename,databasever) '创建数据库 %> |
% db_path = "cnbruce.mdb" Set conn= Server.CreateObject("ADODB.Connection") connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Server.MapPath(db_path) conn.Open connstr %> |
!--#include file="conn.asp" --> % Set rs = Server.CreateObject ("ADODB.Recordset") sql = "create table aboutme (id integer primary key,name text,Birthday datetime)" rs.Open sql,conn,2,3 %> 数据库表文件建立完毕。 |