ADO连接Oracle/access示例及记录集处理源码
时 间:2007-11-12 14:04:10
作 者:5988143整理 ID:379 城市:东莞
摘 要:ADO连接Oracle/Access示例及记录集处理源码
正 文:
Option Explicit
Public Enum RSMethod
VIEW_RECORD = 0
EDIT_RECORD = 1
EXEC_SQL = 2
NEW_RECORD = 3
End Enum
Function dbConnection(strDatabaseType As String, strDBService As String, Optional strUserID As String, Optional strPassword As String) As ADODB.Connection
Dim objDB As New ADODB.Connection
Dim strConnectionString As String
If strDatabaseType = "ORACLE" Then
'定义 orACLE 数据库连接字符串
strConnectionString = "Driver={Microsoft ODBC Driver For oracle};CCOLOR: #0000ff">& strDBService & ";UID=" & strUserID & ";PWD=" & strPassword & ";"
ElseIf strDatabaseType = "MSACCESS" Then
'定义 Microsoft Access 数据库连接字符串
strConnectionString = "DBQ=" & strDBService
strConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; " & strConnectionString
End If
With objDB
.Mode = adModeReadWrite ' 连接模式 ???
.ConnectionTimeout = 10 '超时
.CommandTimeout = 5
.CursorLocation = adUseClient
.Open strConnectionString '打开数据库连接
End With
Set dbConnection = objDB
End Function
Function CreateRecordSet(ByRef dbConn As ADODB.Connection, ByRef rs As ADODB
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
Public Enum RSMethod
VIEW_RECORD = 0
EDIT_RECORD = 1
EXEC_SQL = 2
NEW_RECORD = 3
End Enum
Function dbConnection(strDatabaseType As String, strDBService As String, Optional strUserID As String, Optional strPassword As String) As ADODB.Connection
Dim objDB As New ADODB.Connection
Dim strConnectionString As String
If strDatabaseType = "ORACLE" Then
'定义 orACLE 数据库连接字符串
strConnectionString = "Driver={Microsoft ODBC Driver For oracle};CCOLOR: #0000ff">& strDBService & ";UID=" & strUserID & ";PWD=" & strPassword & ";"
ElseIf strDatabaseType = "MSACCESS" Then
'定义 Microsoft Access 数据库连接字符串
strConnectionString = "DBQ=" & strDBService
strConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; " & strConnectionString
End If
With objDB
.Mode = adModeReadWrite ' 连接模式 ???
.ConnectionTimeout = 10 '超时
.CommandTimeout = 5
.CursorLocation = adUseClient
.Open strConnectionString '打开数据库连接
End With
Set dbConnection = objDB
End Function
Function CreateRecordSet(ByRef dbConn As ADODB.Connection, ByRef rs As ADODB
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access DCount示...(12.02)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
学习心得
最新文章
- Microsoft ActiveX...(12.04)
- 把一种单位的数量,换算成多个单位的...(12.03)
- 【Access DCount示例】...(12.02)
- Access判断多条明细的配方或订...(11.30)
- 如何让后台数据库在局域网共享时,且...(11.29)
- 【Access月初月末日期设置方法...(11.29)
- 【Access IIF函数嵌套示例...(11.26)
- Access快速开发平台--使用组...(11.25)
- Access快速开发平台--对上传...(11.22)
- Access快速开发平台企业版--...(11.18)