在Listview控件中显示表名称 [英] Displaying Table name in Listview Control

查看:81
本文介绍了在Listview控件中显示表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我不知道是否可以在数据库的列表视图控件中显示表名.

它是这样的.

我在Sql Server 2008中有一个表(几个).有时我被要求代表有关客户端ID(唯一属性)的数据库的当前状态,为了提供此信息,我必须进行查询.

为了避免这种情况,我设计了一种表单,其中用户输入客户端ID,结果显示在列表视图中,并带有来自数据库的当前状态.

现在我已经解决了.我不知道在列表视图中显示表名称.例如:选择[客户ID],将min([发票月]]作为开始日期,将最大值([发票月]]作为结束日期从[客户ID]的tbl_catalogue_Tax_spend_analysis组中选择.

所以我的表名是:catalogue_Tax_spend_analysis.

如何在列表视图控件中显示此名称.




在此先感谢您.

Hi to all,
I don''t know whether it is possible or not, to display table name in list view control from database.

It goes like this.

I have a tables(several) in Sql Server 2008. sometime i was asked to represent the current status of database in respect to client id (unique attribute), in order to provide this information i have to do query.

To avoid this, i designed a form wherein a user enters client id and results appear in list view with the current status from the database.

Now i m in a fix. I dont know to display the table name in list view. For ex: select [client id], min([invoice month]) as startdate, max([invoice month]) as enddate From tbl_catalogue_Tax_spend_analysis group by [client id].

so my table name is : catalogue_Tax_spend_analysis.

How do i display this name in my listview control.

Please


Thanks in advance.

推荐答案

您必须阅读每个字符的字符串.首先找出在字符串中找到FROM的位置,然后读取字符,直到找到空格或逗号为止.再检查一次.如果查询后的IF以[您必须找到下一个]开头.然后,您有了表名,可以将其放在列表视图中.
You have to read the string per character. First find out where FROM is found in your string and then read the character until you find a space or a comma. One more if to check. IF after the from the query starts with a [ you have to find the next ]. Then you have your tablename and can place it in your listview.


这篇关于在Listview控件中显示表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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