设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1429|回复: 6
打印 上一主题 下一主题

[ADO/DAO] 在ADO中怎样取得一个表的所有字段名?-->WTM1转移

[复制链接]
1#
发表于 2002-10-10 02:50:00 | 显示全部楼层
Public Sub findname()

    Dim rst As New ADODB.Recordset
    Dim Tbname As String
    Dim FieldsCount As Integer
    Dim i As Integer
   
    Tbname = "computer"
    rst.Open "select top 1 * from " & Tbname, CurrentProject.Connection
        
    FieldsCount = rst.Fields.Count
    For i = 0 To FieldsCount - 1
        Tbname = Tbname & vbNewLine & rst.Fields(i).Name
    Next
    MsgBox Tbname
    rst.Close
   
End Sub
2#
发表于 2002-10-10 02:54:00 | 显示全部楼层
ADOX不会用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-16 15:25 , Processed in 0.080577 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表