vba - 将本地 MS Access 数据库中的表记录插入 Oracle 表
问题描述
我正在尝试将本地 Access 数据库中的记录插入到 Oracle 表中。两个表中的相同字段。
如果不需要的话,我不想遍历这些行。我必须编写代码才能连接到 oracle 数据库。只是不确定选择名为“RET_PARTS”的本地 Access 表并将该数据插入名为 RET2_PARTS_ORACLE 的 Oracle 表的代码”
Sub subFastUpload()
`enter code here`On Error GoTo Err_subFastUpload
`enter code here`Dim intlength As Integer
`enter code here`intlength = 8
`enter code here`Dim strServer As String
strServer = "MARS"
Const maxItems = 500
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim objRst As New ADODB.Recordset
Dim objCon As New ADODB.Connection
Dim objCmd As New ADODB.Command
Dim strTable As String
Dim intCount As Integer
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Ret2_Parts")
Dim mars_pass As String
'mars_pass = InputBox("Enter MaRS Password")
mars_pass = "XXXXXXX"
intCount = 1
If strServer = "MARS" Then
strTable = Environ("UserName") & ".RET2_PARTS_ORACLE"
objCon.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=MARSNEW.123;User ID=" & Environ("UserName") & ";Password=" & mars_pass & ";"
strTable = Environ("UserName") & ".RET2_PARTS_ORACLE"
End If
objCon.Open
objCmd.ActiveConnection = objCon
objCmd.CommandType = adCmdText
objCmd.Properties("PLSQLRSet") = False
While Not rst.EOF
If intCount = 1 Then
strSQL = "Select * from RET2_Parts"
Debug.Print strSQL
解决方案
推荐阅读
- python - Beta-Variational AutoEncoder 无法解开
- rabbitmq - 多个 RabbitListeners。一个不行
- python - 如何将此频率检查代码更改为不区分大小写?
- c# - 转换任何一个
> 到选项 > 在 c# LanguageExt 中 - c# - 如何在 ASP.NET Core 3.1 的 IAuthorizationHandler 中访问会话数据?
- mysql - SQL 查询 JOIN 未找到时返回 null 的两个表
- php - 在 Laravel 文件夹中执行 require_once 的问题
- mysql - 查询不返回前几个月的数据,如果为空则为零
- qt - 带有 HERE 插件的 Qt Qml Map 如何正确使用 here.token 进行身份验证
- json - 为什么 IATA 选择 XML 而不是 JSON 来提供 NDC 服务?