如何使用“模板"字段绑定另一个表的值 [英] how to bind value of another table using Template field

查看:93
本文介绍了如何使用“模板"字段绑定另一个表的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有两个表,一个是Building Master,其中包含字段(Bid,BuildingName)
另一个表是Floor Master,它具有字段(Fid,Floorname,BID).BID是显示Building master ID的外键.我是在template字段的帮助下自定义Floor Page中的gridview的.该网格视图将显示楼层所在的楼层编号,楼层名称和建筑物名称.但是在绑定过程中存在问题.实际上在楼层主表中只有建筑物ID而没有建筑物名称.因此如何在网格视图中绑定模板字段,以便将其命名为建筑物名称从Building Master表中获取,并显示在楼层"页面中,其中包含模板字段.


感谢您的问候,
Amit

Hello All,
I have two tables one is Building Master which has fields (Bid,BuildingName)
and another table is Floor Master which has fields(Fid,Floorname,BID).BID is the foreign key which shows the ID of Building master.I am customized the gridview in floor Page with the help of template field.This grid view will display Floorid,Floorname and Building Name in which that floor exist.But There is problem during Binding.Actually In floor Master Table There is only Building Id and Not Building Name.So How to Bind Template Field In grid view So That it will Brought building Name from Building Master table and will display in Floor page with template Field.


Thanks with Regards,
Amit

推荐答案

您可以在检索数据时使用联接,如下所示:

选择Fid,将fm.Floorname作为floorname,选择bm.BuildingName作为BuildingName
来自FloorMaster fm,BuildingMaster bm
其中fm.Bid = bm.BID
You can use joins while retreiving the data as below:

select Fid, fm.Floorname as floorname, bm.BuildingName as BuildingName
from FloorMaster fm, BuildingMaster bm
where fm.Bid = bm.BID


请尝试以下操作:

try this:

select * from FloorMaster a Left Join BuildingMaster b on
a.BID=b.Bid 


在模板中同时加入表和绑定字段名称.
Join both the table and bind field name in template.


这篇关于如何使用“模板"字段绑定另一个表的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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