如何使用MS SQL DABABASE TABLE中的列数据在asp.net C#中创建动态表

编程入门 行业动态 更新时间:2024-10-24 04:37:33
本文介绍了如何使用MS SQL DABABASE TABLE中的列数据在asp C#中创建动态表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

而不是采用gridview,Iam尝试从asp中的后端代码c#生成一个表;; 我们看到通过gridview,我们将将gridview连接到数据库,我们将获得数据库表中的所有值;;就像iam试图通过从后端代码C#生成表一样,我想通过查询来从数据库中显示表中的数据sql

Instead of taking gridview, Iam trying to generate a table from backend code c# in asp;; As we see that by taking gridview, we will connect gridview to database and we will get all values present in the data base table;; same like that iam trying to do by generating table from backend code C# and I want to pass query to show data in table from data base sql

推荐答案

这很简单在MVC中你觉得C#很复杂。因为你必须为分类,分页和itemCommand编写单独的代码。 对于简单的表绑定,首先指定文字/标签 It was quite simple in MVC but you feel complex in C#. Because you have to write seperate code for sorting, paging and itemCommand. For simple table binding, First assign literal/ label <asp:literal id="ltlTable" runat="server" xmlns:asp="#unknown" />

string strVal= "<table>"; for(int i=0;i<datatable.columns.count;i++)> { strVal+="<tr>"; for(int j=0;j&<datatable.rows.count;j++)> { strVal+="<td>"; strVal+= dataTable.Rows[i][j].toString(); strVal+="</td>"; } strVal+="</tr>"; } strVal+="</table>"; ltlTable.Value = strVal.toString();

更多推荐

如何使用MS SQL DABABASE TABLE中的列数据在asp.net C#中创建动态表

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

发布评论

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

>www.elefans.com

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