本文介绍了如何使用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#中创建动态表
发布评论