任何人都可以帮助Crystal Reports [英] Can anyone help with Crystal Reports

查看:73
本文介绍了任何人都可以帮助Crystal Reports的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





大家好



我有水晶报告3参数公司,城市,姓氏



我用3个组合框制作了一个表格

cbCompany从公司取价值

来自city的cbCity和来自lastname的ComboBox3



这是我填写组合框的方式





Hi guys

I have a crystal report with 3 parameters company,city,lastname

I made a form with 3 ComboBoxes
cbCompany take values from company
cbCity from city and ComboBox3 from lastname

This is how I fill the ComboBoxes

Private Sub fill_city()
        cn = New SqlConnection(strCon)
        cn.Open()
        cm = New SqlCommand("Select distinct City From Staff", cn)
        dr = cm.ExecuteReader
        While dr.Read
            cbCity.Items.Add(dr("City").ToString)
        End While
        cn.Close()
    End Sub

    Private Sub fill_company()
        cn = New SqlConnection(strCon)
        cn.Open()
        cm = New SqlCommand("Select distinct Company From Staff", cn)
        dr = cm.ExecuteReader
        While dr.Read
            cbCompany.Items.Add(dr("Company").ToString)
        End While
        cn.Close()
    End Sub





问题是我想从cbCompany中选择一个值

cbCity只为这家公司取价值





提前谢谢



The problem is that I want when I choose a value from cbCompany
the cbCity to take values only for this company


Thanks in advance

推荐答案

我怀疑你的问题是关于Crystal Report还是表单组合框逻辑?

您的组合框应该作为级联组合框工作。



首先将项目填充到公司组合框 cbCompany 。然后在用户选择公司时加载城市组合。您可以使用cbCompany SelectedIndexChanged事件加载城市组合。



您必须修改City组合存储过程



I am doubt your question is regarding Crystal Report or the form combo box logic?
your combo box should work as cascade combobox.

first fill the item to the company combo box cbCompany. then load the city combo when the user select a company. you can load the city combo with cbCompany SelectedIndexChanged event.

you have to modify the City combo stored procedure as

string selectedCompany= cbCompany.SelectedValue;
cm = New SqlCommand("Select distinct City From Staff Where Company='" + selectedCompany + "'", cn)





我对VB.net编码不太熟悉。可能是语法不正确。



I''m not much familer with VB.net coding. may be syntax are not correct.


这篇关于任何人都可以帮助Crystal Reports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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