跨表查询 [英] Query Across Tables

查看:64
本文介绍了跨表查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,这些是为了更好地解释我的问题的屏幕截图.

Hi guys here are the Screenshots to better Explain my Question.

这是屏幕(Detalle Horas).

我需要在屏幕上查询(详细信息Horas)

仅过滤属于员工项目的项目表中的Proyectos from Table(PROYECTOS).

在表(PROYECTOS ASIGNADOS)和员工表(EMPLOYEADOS)中.使用用户名登录用户时.

This is the Screen( Detalle Horas ).

I need to make a query in the Screen ( Detalle Horas )

which filters the Proyectos From Table (PROYECTOS) only the projectos Which are employee Projects.

Which is in the Table (PROYECTOS ASIGNADOS) and Employee Table (EMPLOYEADOS). When the User is Logged In with User Name.


请指导我为我的公司这样做.

将非常感谢您的帮助.

帕拉姆·辛格

Will appreciate any Help.

Param Singh

推荐答案

你好

同样,我认为这里的语言障碍可能会被打破,但这对您而言应该是一个简单的解决方法.为了证明我的意思,我使用了具有一些链接表的演示项目.同样,我使用的是Visual Studio的早期版本 但原理仍然相同.

Again, I think the language barrier may be broken here but this *should* be a simple fix for you. In order to demonstrate what I think you mean I have used my demo project that has some linked tables. Again, I am using an earlier version of Visual Studio but the principals are still the same. 

在第一个屏幕截图中,您看到我的表与其他两个表有关系.然后,我选择了添加新查询(YourQueryName),这将带您进入第二个屏幕截图的顶部.在这里,我已经选择了列字段和 您可以看到它级联到下一个联接表中(即MatchPlayers联接到Match上),并且我可以选择MatchName.我假设您的员工是一个字符串,用户名将是一个字符串,并使用此示例.然后,我让它创建一个新的字符串 我称之为YourUserName.

In the first screenshot you see my table that has a relationship with two other tables. I have then selected Add a new query (YourQueryName) and this takes you to the top part of the second screenshot. Here I have seleted the the column fields and as you can see it cascades into the next joined table (i.e. MatchPlayers is joined to Match) and I can select MatchName. I am assuming that your employee is a string and the username will be a string and using this example. I then let it create a new string Parameter which I have called YourUserName.

第二个屏幕截图的底部,您将看到屏幕设计视图.我已在屏幕左侧和属性选择的查询源"下的右侧选择了MatchPlayersSet(以前在屏幕上的数据表). 然后,这将显示新创建的您的查询名称"查询,并在选中后在对象左侧添加对象MatchPlayersYourUserName.从这里单击编写代码"按钮旁边的小箭头,然后选择"InitialiseWorkspace"选项. 然后输入以下代码:-

The the bottom part of the second screenshot you see the screen design view. I have selected the MatchPlayersSet (the data table that was on the screen previously) on the left of the screen and on the right under the properties selected the Query Source. This then shows the newly created query of Your Query Name and when selected adds the object MatchPlayersYourUserName on the left of the objects. From here you click on the small arrow next to the Write Code button and select the InitialiseWorkspace option and then enter the following code:-

        partial void MatchScreen_InitializeDataWorkspace(List<IDataService> saveChangesTo)
        {
            // Write your code here.
            MatchPlayersYourUserName = this.Application.User.FullName;
        }



这篇关于跨表查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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