在数据库sqlserver中显示数据到表html

编程入门 行业动态 更新时间:2024-10-27 00:30:40
本文介绍了在数据库sqlserver中显示数据到表html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Hai All帮我,如何显示数据库显示到表格的数据.. ??? 我的代码:

Hai All Help me,, How to Display data from database show to table html ..??? my code :

<table class="TableTour2" border="0" cellSpacing="0" cellPadding="0" width="500"> <tbody> <tr> <th scope=col>City</th> <th scope=col>Deluxe Class</th> <th scope=col>Superior Class</th> <th scope=col>Standard Class</th> </tr> <% Dim cnnPH As New System.Data.SqlClient.SqlConnection Dim drPH As System.Data.SqlClient.SqlDataReader Dim cmdPH As System.Data.SqlClient.SqlCommand Try cnnPH.ConnectionString = ConStr cnnPH.Open() cmdPH = New System.Data.SqlClient.SqlCommand("SELECT * from tbdata ") drPH = cmdPH.ExecuteReader While drPH.Read %> <tr> <th class=sub><%Response.Write(drPH("CityName"))%> </th> <td><% Response.Write(drPH("HotelName"))%></td> <td><% Response.Write(drPH("HotelName"))%></td> <td><% Response.Write(drPH("HotelName"))%></td> </tr> <% End While drPH = Nothing cnnPH.Close() : cnnPH = Nothing Catch ex As Exception MsgBox(ex.Message) drPH = Nothing cnnPH.Close() : cnnPH = Nothing End Try %> </tbody> </table>

但数据不显示 谢谢

but data not display thanks

推荐答案

使用GridView和SQLDataSource显示数据你不确定如何编码。 将GridView拖放到你的页面然后a n SQLDataSource。 查看下面的例子,你应该能够把它搞定。如果你仍然卡住那么请告诉我们。 asp-net-example.blogspot.sg/2008/10/gridview-example-how-to-populate.html [ ^ ] Use a GridView and a SQLDataSource to display the data if your not sure on how to code it in. Drag and drop a GridView on to your Page and then an SQLDataSource. Check the example below you should be able to make it out. if your still getting stuck then let us know. asp-net-example.blogspot.sg/2008/10/gridview-example-how-to-populate.html[^]

更多推荐

在数据库sqlserver中显示数据到表html

本文发布于:2023-10-23 23:11:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1522277.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   数据   sqlserver   html

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!