End If
End With
With oJetEngine
.CompactDatabase SourceConn, DestConn
End With
oFSO.DeleteFile AppPath() & strDBFileName
oFSO.MoveFile AppPath() & "Temp" & strDBFileName,AppPath() & strDBFileName
Set oFSO = Nothing
Set oJetEngine = Nothing
CompactDBFile = True
End Function
End Class
Dim ManDb
Set ManDb = New RLManDBCls
''//---------连接SQL数据库--------------
''ManDb.DBType = "SQL"
''ManDb.ServerName = "TAO-KUIZU"
''ManDb.UserName = "sa"
''ManDb.Password = "123456"
''ManDb.DBPath = "hhstuss"
''ManDb.CreateTable "cexo255","id int Not Null PRIMARY KEY, Name varchar(20) Not Null" ''建立表(表名)
''ManDb.ReNameTable "cexo255","cexo2552" ''表改名(旧表名,新表名)(用组件)
''ManDb.DelTable "cexo255" ''删除表(表名)
''ManDb.AddColumn "cexo255", "Sex", "varchar(2) null" ''建立表结构(表名,字段名,数据类型)
''ManDb.ModColumn "cexo255", "name", "int Not null" ''修改表结构(表名,字段名,新数据类型)_
''ManDb.DelColumn "cexo255", "Sex" ''删除表结构(表名,字段名)
''ManDb.AddIndex "cexo255", "i_ID", "ID" ''建立表索引(表名,索引名,索引字段名)
''ManDb.DelIndex "cexo255", "i_ID" ''删除表索引(表名,索引名)
''ManDb.AddPRIMARYKEY "cexo255","name" ''建立表主键(表名,主键字段名)
''ManDb.DelPRIMARYKEY "cexo255","name" ''删除表主键(表名,主键字段名)_
''Response.Write ManDb.GetPrimaryKey("cexo255") ''取表的主键(表名)
''ManDb.upColumn "cexo255","id",12345,"name = 1" ''修改字段的值
''ManDb.Execute "insert空格into cexo255(id,Name) values (2,2)" ''添加记录
''ManDb.Execute "Update cexo255 Set id = 3 Where Name = 2" ''修改记录
''ManDb.Execute "delete空格From cexo255 Where Name = 2" ''删除记录
''ManDb.Execute("Select Count(*) From cexo255"):Response.Write ManDb.Count ''统计记录个数
''If ManDb.CheckTable("StudInfo") THen Response.Write "StudInfo表存在!!!" Else Response.Write "StudInfo表不存在!!!"
''//-----------End--------------------------
''//---------连接Access数据库--------------
ManDb.DBType = "ACCESS"
ManDb.DBPath = "test.mdb"
''ManDb.CreateDBfile "test2.mdb","" ''建立数据库(数据库名,保存路径)
''ManDb.DeleteDBFile("test2.mdb") ''删除数据库(数据库名)
''ManDb.RenameDBFile "test2.mdb","test3.mdb" ''数据库改名(旧数据库名,新数据库名)
''ManDb.CompactDBFile("test3.mdb") ''压缩数据库(数据库名)
''ManDb.CreateTable "dw","" ''建立表(表名)
''ManDb.ReNameTable "dw","dw2" ''表改名(旧表名,新表名)(用组件)_
''ManDb.DelTable "dw"