当前位置:网站首页>在EXCEL写VBA连接ORACLE并查询数据库中的内容
在EXCEL写VBA连接ORACLE并查询数据库中的内容
2022-07-07 06:41:00 【CSDN问答】
在EXCEL写VBA连接ORACLE并查询数据库中的内容
Sub searchDB()
Set CNN = CreateObject("ADODB.Connection")Set rst = CreateObject("ADODB.Recordset")CNN.Open "Driver={Oracle in instantclient_19_14};Dbq=mesproc;User Id=IQC_CHECKER;Password=iqc_123456;"Set rst = CNN.Execute("select iqc.no from MES_PROD.IQC_BILL iqc where iqc.no = '" & ActiveSheet.Cells(1, 2) & " '")For j = 0 To rst.Fields.Count - 1 Cells(1, j + 1) = rst.Fields(j).NameNextRange("A1").CopyFromRecordset rstCNN.CloseEnd Sub
可成功连接但是不知道怎么修改内容 ,我会写VBA查询SQLSERVER的, 但是不知道ORACLE的怎么写。 比如我知道列的名字 ,怎么去写SELECT FROM 然后选择那个单元格copyfrom 我只会跟着模板依葫芦画瓢 所以不会写了
想要根据NO号查到 各个列的值
边栏推荐
- Port occupation troubleshooting
- STM32的时钟系统
- 【SVN】SVN是什么?怎么使用?
- Postman interface test (I. installation and use)
- Analysis of Hessian serialization principle
- External interrupt to realize key experiment
- Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
- What is the rating of Huishang futures company? Is it safe to open an account? I want to open an account, OK?
- Locust performance test 3 (high concurrency, parameter correlation, assembly point)
- Huawei hcip datacom core_ 03day
猜你喜欢
随机推荐
Locust performance test 2 (interface request)
PMP experience learning and sharing process
信息安全实验四:Ip包监视程序实现
网易云微信小程序
華為HCIP-DATACOM-Core_03day
Windows starts redis service
Redis common commands
Count the number of words in the string c language
DRF defines views and routes
On December 8th, 2020, the memory of marketing MRC application suddenly increased, resulting in system oom
C language pointer (Part 2)
LeetCode每日一题(2316. Count Unreachable Pairs of Nodes in an Undirected Graph)
Jenkins automated email
Network request process
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
华为HCIP-DATACOM-Core_03day
Chaosblade: introduction to chaos Engineering (I)
How to pass the PMP Exam in a short time?
信息安全实验二 :使用X-SCANNER扫描工具
Difference between interface iterator and iteratable









