| 发表于:2007-04-28 10:08:193楼 得分:0 |
'************** 函数功能:建立动态数据库 '************** 修改日期:2006-11-14 public function createdyndatabase() dim cat as new adox.catalog dim tb1 as new table dim con as new adodb.connection dim idx1 as new adox.index dim key1 as new adox.key on error goto err1 if dir( "mdb\sssj ", vbdirectory) = " " then '创建文件夹 call createfolder( "mdb\sssj ") end if temp = ctemp(date) if dir( "mdb\sssj\ " & temp & ".mdb ", vbnormal) <> " " then exit function cat.create "provider=microsoft.jet.oledb.4.0;data source=mdb\sssj\ " & temp & ".mdb " '创建数据库 con.connectionstring = "provider=microsoft.jet.oledb.4.0;data source=mdb\sssj\ " & temp & ".mdb; " 'con.commandtimeout = 30 con.open set cat.activeconnection = con tb1.name = "tbltemp " ' temp '创建数据表 tb1.columns.append "时间 ", addate tb1.columns.append "编号 ", adinteger cat.tables.append tb1 '添加目录 con.close set con = nothing exit function err1: msgbox "createdyndatabase函数出错! " end function | | |
|