VB6中的部门明智的数据报告 [英] Department wise Data Reports in VB6

查看:52
本文介绍了VB6中的部门明智的数据报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们

我有一个运行得非常好的项目,但现在我有一个小问题。实际上我想生成所有部门的数据报告,但性别明智。例如

i有一个表患者,其中包含以下字段

Reg_No,Patientname,Residence,Age,Sex,Department,Date,Time



现在我想生成左侧所有部门的报告,并显示各个部门的所有患者,但分别显示男性和女性。









部门男性女性

ENT 20 15

牙科45 34



20和15是耳鼻喉科的男性和女性患者。

同样45和34是牙科的男女患者。









请帮助



Sarfaraz

Dear friends
I have a project which is running absolutely fine but now i have a small issue in it. Actually i want to generate a Data report of all the departments but Gender wise. Eg
i have a table patients which has the following fields
Reg_No,Patientname, Residence,Age,Sex,Department, Date,Time

Now I want to generate reports of all the departments on left side and display all the patients of individual departments but showing Male and female separately.




DEPARTMENT MALE FEMALE
ENT 20 15
Dental 45 34

20 and 15 are male and female patients of ENT Department.
Similarly 45 and 34 are male and female patients of Dental Department.




Please help

Sarfaraz

推荐答案

如果20,15,45,34是特别部门的患者数,那么获取结果的查询...



If 20, 15, 45, 34 is the Count of Patients in Particular Department than, here''s the Query to get your result...

SELECT Department, Sex, COUNT(*) FROM [My Patient] GROUP BY Department ORDER BY SEX DESC





你得到的结果如下,



You Get Results like,

Department  Sex   Expr1
ENT        Male     20
ENT        FEMALE   15
DENTAL     Male     45
DENTAL     FEMALE   34 



在您的计划中处理此结果...

这里是用于在网格中设置结果的VB代码。




Process this Results in Your Program...
Here''s VB Code for Setting Results in Grid.

' Let DG as DataGridView where you displaying Results
' Dr is the DataReader Which Holds above Result
Do While Dr.Read
    Select case Ucase(Dr.GetValue(1))
    Case UCase("Male")
        DG.Rows.Add()
        DG.Rows(DG.RowCount - 1).Cells(0).Value = Dr.GetValue(0)
        DG.Rows(DG.RowCount - 1).Cells(1).Value = Dr.GetValue(2)
    Case UCase("Female")
        DG.Rows(DG.RowCount - 1).Cells(2).Value = Dr.GetValue(2)
    End Select
Loop


这篇关于VB6中的部门明智的数据报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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