通过C#,ASP.NET代码在列的字段上工作 [英] work on a field of column By C#, ASP.NET code

查看:63
本文介绍了通过C#,ASP.NET代码在列的字段上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


假设您在其中有三列表名,即fn,ln和代码.有没有办法在第四个字段中的fn列放置一个标签?
该表在sql

Hi,
Suppose you have three columns of table names, fn, ln, code there. Is there a way that column fn in the fourth field put a lable?
The table is in sql

推荐答案

中有一个类似 Object type的类型,您的问题不清楚..
There is an type like Object type , your question is not clear..


尝试一下,

http://www.mikesdotnetting.com/Article/64/将数据从SqlDataSource绑定到标签 [
try this,

http://www.mikesdotnetting.com/Article/64/Bind-Data-From-a-SqlDataSource-to-a-Label[^]


通过此链接
http://blog.sqlauthority.com/2008/06 /07/sql-server-pivot-and-unpivot-table-examples/

在Google上搜索数据透视表.

如果您使用的是datset,则
Go through this link
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/

Search for pivot table on google.

If you are using datset then
lblTest.Text= ds.Tables[0].Rows[3]["fn"].ToString();



如果使用数据表



If using datatable

lblTest.Text = table.Rows[3]["fn"].ToString();



如果使用datareader



If using datareader

DataReader  dr = cmd.ExecuteReader();
int temp =0;
                while(rdr.Read())
                {
                    temp = temp+1;
            if(temp ==3)
            {
            lblTest.Text = dr["fn"].Tostring();
            }
                }


这篇关于通过C#,ASP.NET代码在列的字段上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆