或其他支持dso的標記,給這個標記加入datafld屬性,屬性值就是所要顯示的字段名,當xml文檔多層嵌套的的時候,最外層使用datasrc="#",第二層用datafld="",第三層則同時使用 datasrc 和 datafld.[/p]
[p]例子如下:[/p]
[p]數據庫表圖:[/p]
[img]http://jinminghou.cn/download/images/d86b09b5a682d0c836d3caa4.gif[/img]
代碼如下:
<%[br][color=#ff0000][color=#ff00ff]response.contenttype = "text/xml"[/color] [br]dim sql,rs,dd,conn[br]sql="select * from tb_book "[br]dd="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("xml.mdb")[br]set conn=server.createobject("adodb.connection")[br]conn.connectionstring=dd[br]conn.open [br]set rs=conn.execute(sql)[br][/color]%>[br][br]
[br]<%[color=#ff0000]do while not rs.eof[/color]%>[br] [br] <%=[color=#ff0000]rs("title")%[/color]>[br] <%[color=#ff0000]=rs("author")%[/color]>[br] [br] <%=rs("[color=#ff0000]publisher[/color]")%>[br] <%=[color=#ff0000]rs("isbn")%[/color]>[br] [br] <%=[color=#ff0000]rs("price")%[/color]>[br] [br]<%[br][color=#ff0000]rs.movenext[br]loop[br]set rs=nothing [br]conn.close[/color][br]%>[br]
[p]html文件代碼為:[/p]
[p][br][br]
new document [br][br]
[br][br]
[br] [br]書名 | [br]作者 | [br]出版社信息 | [br]定價 | [br] [br] [br] | [br] | [br][br][br][br]出版社 | [br] isbn | [br][br][br] | [br] | [br] [br] [br] | [br] | [br]
[br]
[br][br][/p]
[p]效果如圖:[/p]
[img]http://jinminghou.cn/download/images/fe4fc7ca01726180c8176876.gif[/img]
[p][/p]
[p][/p]
[p][/p]
[p][color=#000000]稍微修改html界面:[/color][/p]
[p][br][br]
例子代碼 [br][br]
[br][br]
[br] [br]書名 | [br]作者 | [br]出版社 | [br] isbn | [br]定價 | [br] [br] [br] | [br] | [br][br][br] | [br] | [br]
[br]
[br][br][/p]
[p]效果如圖:[/p]
[p][/p]
[p][img]http://hiphotos.baidu.com/xwx520/pic/item/61f19f11af438116b8127b44.jpg[/img][/p]
該文章在 2010/7/23 2:33:02 編輯過