检索ADO记录集的字段名(经典ASP) [英] Retrieve ADO Recordset Field names (Classic ASP)

查看:181
本文介绍了检索ADO记录集的字段名(经典ASP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有人能帮助:

I wonder if someone can help:

长话短说,我使用MSSQL2005建立一个透视表。被检查的数据由时间范围限制(所有数据1周从最近星期一到选定的日期)

Long story short, I'm using MSSQL2005 to build a Pivot table. The data being examined is limited by date range (All data for 1 week from the nearest Monday to the date selected)

当我运行存储过程和传递日期,我得到正确的表背例如:

When I run the Stored Proc and pass it a date, I get The correct table back eg:

时间 | 09年1月1日 | 09年1月2日 | 09年1月3日 | ...

Time | 1 Jan 09 | 2 Jan 09 | 3 Jan 09 | ...

09:00 | 0 | 9 | 25 | ...

09:00 | 0 | 9 | 25 | ...

09:30 | 8 | 27 | 65 | ...

09:30 | 8 | 27 | 65 | ...

10:00 | 20 | 44 | 112 | ...

10:00 | 20 | 44 | 112 | ...

(道歉残暴的表格式)。

(Apologies for the atrocious "table" formatting).

我唯一的问题是,列标题会根据双方在传递给SP(所需查看日期)和逻辑的SP内部(这迫使左边一栏是最近的星期一的日期到指定的日期)。

The only problem I have is that the column headers will vary based on both the date passed in to the SP (The desired view date) and the logic inside the SP (which forces the left-hand column to be the nearest Monday to the date specified).

这意味着,当我把结果显示在用户,我(目前)需要复制在传统的ASP日期,检查逻辑[容易,但可维护性失败]

This means that when I display the results to the user, I (currently) need to duplicate the date-checking logic in classic ASP [easy but a maintainability fail]

我真正需要的是从记录本身检索列名的方式。

What I really need is a way of retrieving the column names from the recordset itself.

可有人请点我朝着正确的方向?

Can someone please point me in the right direction?

我GOOGLE了,但所有我得到的结果似乎都与读表模式​​ - 作为在内存中动态生成我的表,它并不在这种情况下,帮助

I've Googled but all the results I get seem to relate to reading a Table Schema - which doesn't help in this case as my table is being generated on the fly in memory.

提前许多感谢任何帮助,您可以提供

Many thanks in advance for any help you can provide

推荐答案

给定一个ADO记录集,你可以做大致有以下(这是伪code):

Given an ado record set you could do roughly the following (This is in psuedo code):

foreach (field in rs.Fields)
{
    alert(field.Name);
}

这会给你的字段的名称看看这个文档

This will give you the name of the field check out this documentation.

这篇关于检索ADO记录集的字段名(经典ASP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆