怎样用excelVBA将sql数据库中数据的列名读

164次

问题描述:

怎样用excelVBA将sql数据库中数据的列名读,在线求解答

推荐答案

2024-01-12 03:04:15

Sub 按钮1_Click()

Dim i As Integer, j As Integer, sht As Worksheet 'i,j为整数变量;sht 为excel工作表对象变量,指向某一工作表

'Dim rs As New ADODB.Recordset '定义记录集对象,保存数据表

‘工具 ---〉引用 ---〉Microsoft ActiveX data objects ....

Set cn = CreateObject(\"Adodb.Connection\")

Set rs = CreateObject(\"Adodb.Recordset\")

Dim strCn As String, strSQL As String '字符串变量

(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6