当前位置:网站首页>在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号查到 各个列的值
边栏推荐
- Mysql database index study notes
- Variable parameter of variable length function
- Interface test API case, data and interface separation
- Reading notes of pyramid principle
- Selenium mouse sliding operation event
- Locust performance test 4 (custom load Policy)
- Jenkins task grouping
- Some pit avoidance guidelines for using Huawei ECS
- What is the rating of Huishang futures company? Is it safe to open an account? I want to open an account, OK?
- 十二、排序
猜你喜欢

STM32 serial port register library function configuration method

Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)

NVIC interrupt priority management

How long does the PMP usually need to prepare for the exam in advance?

【云原生】DevOps(一):DevOps介绍及Code工具使用

Mysql:select ... for update

STM32 and motor development (from stand-alone version to Networking)

Postman interface test (I. installation and use)

网易云微信小程序

MySQL common statements
随机推荐
STM32 clock system
PMP examination experience sharing
The essence of high availability
信息安全实验二 :使用X-SCANNER扫描工具
2021 year end summary
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
C language pointer (Part 1)
Summary of PMP learning materials
Skill review of test engineer before interview
Redis common commands
Jemter operation
JVM 垃圾回收 详细学习笔记(二)
串口實驗——簡單數據收發
Jmeters use
正则匹配以XXX开头的,XXX结束的
Pycharm importing third-party libraries
On December 8th, 2020, the memory of marketing MRC application suddenly increased, resulting in system oom
Leetcode question brushing record (array) combination sum, combination sum II
Systick滴答定时器
NVIC中断优先级管理