在vb6数据报告中使用别名字段名称 [英] Use Alias field name in vb6 Data report

查看:53
本文介绍了在vb6数据报告中使用别名字段名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们

我有一个项目,我需要在我的数据报告上放三个字段namley

DEPARTMENT,SEX,TOTALPATIENTS



这里DEPARTMENT和SEX是我的数据库表中的字段,TOTALPATIENTS是使用以下查询创建的计算字段(别名)

Dear friends
I have a project and i need to put three fields on my data report namley
DEPARTMENT, SEX, TOTALPATIENTS

Here DEPARTMENT and SEX are fields in my data base table and TOTALPATIENTS is the calculated field (Alias) created with the following query

SELECT DEPARTMENT, SEX, COUNT(*) AS TotalPatients
FROM PATIEnts
GROUP BY DEPARTMENT, SEX
ORDER BY DEPARTMENT;





但是我现在有一个问题。

当我在我的VB6数据报告中将DEPARTMENT,SEX和TOTALPATIENTS作为rptlabels和rtptextbox时,它显示未找到数据字段TOTALPATIENTS。

如何解决这个问题。

请帮助



Sarfaraz



But i have a problem now.
When i put DEPARTMENT , SEX and TOTALPATIENTS as rptlabels and rtptextboxes on my VB6 data report it shows data field TOTALPATIENTS not found.
How to solve that.
Please help

Sarfaraz

推荐答案

一种可能的解决方案是使用您在上面显示的select语句在数据库中创建一个视图。然后更改应用程序中的select语句以从视图中进行选择。但是您的应用程序中不需要COUNT(*),因为它将在视图中。因此,您的所有应用程序都会看到没有别名的字段名称。



另一种可能的解决方案是在您的应用程序中重写这样的选择

One possible solution is to create a view in the database using the select statement you are showing above. Then change the select statement in your application to select from the view. But you will not need the COUNT(*) in your application because it will be in the view. So all your application will see is the field names without an alias.

Another possible solution is to re-write the select in your application like this
SELECT DEPARTMENT, SEX, TOTALPATIENTS
FROM (SELECT DEPARTMENT, SEX, COUNT(*) AS TotalPatients
      FROM PATIEnts
      GROUP BY DEPARTMENT, SEX)
ORDER BY DEPARTMENT;





另一种可能的解决方案是VB6数据报告区分大小写。因此,您需要将别名更改为AS TOTALPATIENTS或将rptlabel更改为TotalPatients。



Another possible solution is that the VB6 data report is case sensitive. So you would either need to change the alias to "AS TOTALPATIENTS" or change the rptlabel to "TotalPatients".


这篇关于在vb6数据报告中使用别名字段名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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