在线急:sql语句,取得列名字怎么写?

dongpo1 2004-04-29 05:25:51
同上
...全文
121 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengyi2004 2004-04-29
  • 打赏
  • 举报
回复
<% set conn = Server.CreateObject("adodb.connection")
conn.open "pubs","sa"
set rs=conn.execute("select * from authors")
for i=0 to rs.Fields.Count-1 %>
<% =rs(i).name %>
</ul>
<% next
conn.close %>
你改一些库名什么的就可以了。
skyboy0720 2004-04-29
  • 打赏
  • 举报
回复
rs.recordcount
rs.pagesize
rs.cachesize
rs.pagecount
..........

找本书看看就知道了!
dongpo1 2004-04-29
  • 打赏
  • 举报
回复
上上楼主的对, 列数是 rs.fields.count


to wdyxt(啊龙) :

rs和conn还有哪些属性呢?
skyboy0720 2004-04-29
  • 打赏
  • 举报
回复
select name from syscolumns where id=object_id('表名')
Tonglu 2004-04-29
  • 打赏
  • 举报
回复
Set rs=server.CreateObject ("Adodb.Recordset")
strsql="select * from table"
rs.Open strsql,conn,1,1
for i=0 to rs.fields.count-1
Response.Write rs(i).name
next
wdyxt 2004-04-29
  • 打赏
  • 举报
回复
<%dim rs
set rs=Getrecordset("数据库名","表名")%>
whghwujx 2004-04-29
  • 打赏
  • 举报
回复
fields(i).name
wdyxt 2004-04-29
  • 打赏
  • 举报
回复
<% for i=0 to rs.fields.count-1
response.write rs.fields(i).name&"</br>"
next
%>
输出所有字段的名字,rs.fields.count为字段数
youhuowx 2004-04-29
  • 打赏
  • 举报
回复
我也想知道,关注下(主要是列的E文不知道)
wdyxt 2004-04-29
  • 打赏
  • 举报
回复
rs.fields(i).name
yslcuk 2004-04-29
  • 打赏
  • 举报
回复
desc 表名
可以得到该表的表结构

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧