''数据库类型.
Public Enum SmDbType
Access = 1 ''Access
Excel = 2 ''Excel
Text = 3 ''文本
FoxPro = 4 ''FoxPro
dBase = 5 ''dBase
End Enum
''
''创建一个连接(连接到其它数据库类型)
''函数名:CreateOtherConn
''参数: DbConnection ADODB连接,FilePath 数据库路径,UserName 登录用户名,PassWord 登录密码,DbType SmDbType枚举数据库类型
''返回值:TRUE 连接成功.FALSE 连接失败.
''例:
''CreateOtherConn Cnn, "E:\CjhLx\dbf", , , FoxPro
''StrSql = "select * from [employee.dbf]"
''Set Rs = RsOpen(Cnn, StrSql)
''Set DataGrid1.DataSource = Rs
Public Function CreateOtherConn(ByRef DbConnection As ADODB.Connection, _
FilePath As String, _
Optional UserName As String = "admin", _
Optional PassWord As String = "", _
Optional DbType As SmDbType = Access) As Boolean
Dim ConnStr As String
Dim DriveName(5) As String
Dim tDbType(5) As String
Dim UserPwd(5) As String
''驱动
程序 DriveName(1) = "{Microsoft Access Driver (*.mdb)}"
DriveName(2) = "{Microsoft Excel Driver (*.xls)}"
DriveName(3) = "{Microsoft Text Driver (*.txt; *.csv)}"
DriveName(4) = "{Microsoft Visual FoxPro Driver};SourceType=DBF"
DriveName(5) = "{Microsoft dBase Driver (*.dbf)}"
''类型
tDbType(1) = "MDB"
&