如何使用SQL在Access中的表中列出字段名称

前端之家收集整理的这篇文章主要介绍了如何使用SQL在Access中的表中列出字段名称前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果可以列出MS Access表中的所有字段名称,请告诉我吗?

谢谢

解决方法

我在ms访问太多了.

我知道这样做的唯一方法是使用vba,并定义例如记录集,并循环遍历字段.

例如:

@H_404_12@dim rst as new adodb.recordset rst.open "SELECT * FROM SoMetable",CurrentProject.Connection,adOpenForwardOnly,adLockReadOnly ' Note: adOpenForwardOnly and adLockReadOnly are the default values ' ' for the CursorType and LockType arguments,so they are optional here ' ' and are shown only for completeness ' dim ii as integer dim ss as string for ii = 0 to rst.fields.count - 1 ss = ss & "," & rst.fields(ii).name next ii

字符串变量ss将包含名为“SoMetable”的表中所有列名的逗号分隔列表.

通过稍微重新格式化逻辑,您应该能够将此数据插入到另一个表中,然后查询它.

这有帮助吗?

猜你在找的MsSQL相关文章