双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

仍然是压缩mdb文件的问题

shawls shawls 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

使用ado2.5的版本!

如何压缩

参考:

http://www.csdn.net/expert/topic/530/530394.xml?temp=.7059595


一下代码问题在于不支持长文件名,转化以后也不行,请大家给出更好的方法,这个是使用odbc的东西!

代码:


不支持长文件名


Option Explicit
'********************************************************************
Const ODBC_ADD_DSN = 1 ' Add data source
Const ODBC_CONFIG_DSN = 2 ' Configure (edit) data source
Const ODBC_REMOVE_DSN = 3 ' Remove data source

#If Win32 Then

Private Declare Function SQLCONFIGDATASOURCE Lib "odbccp32.dll" Alias "SQLConfigDataSource" _
(ByVal hWndParent&, _
ByVal fRequest%, _
ByVal lpszDriver$, _
ByVal lpszAttributes$) As Boolean

#ElseIf Win16 Then

Private Declare Function SQLCONFIGDATASOURCE Lib "odbcinst.dll" _
(ByVal hWndParent%, _
ByVal fRequest%, _
ByVal lpszDriver$, _
ByVal lpszAttributes$) As Boolean
#End If

Public Sub CompactDb(ByVal strfrom As String, ByVal strto As String)
Dim dbDriver As String
Dim dbAttributes As String
Dim result As Boolean

#If Win32 Then
Let dbDriver = "Microsoft Access Driver (*.mdb)"
#ElseIf Win16 Then
Let dbDriver = "Access Files (*.mdb)"
#End If

Let dbAttributes = "COMPACT_DB=" & strfrom & " " & strto & Chr$(0) _
& "UID=admin" & Chr$(0) _
& "PWD=xxx"

result = SQLCONFIGDATASOURCE(0, ODBC_CONFIG_DSN, dbDriver, dbAttributes)
If (False = result) Then
MsgBox "Establishing DSN failed! Error: " & result
End If

End Sub
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
shawls
VB基础类 7,788 成员 197,583 内容