实体模型和将标签绑定到不相关的表
我试图找出绑定到.Net 中不相关表的最佳方法。 我有一个 ADO .Net 实体数据模型,其中包含几个相关的表和一些不相关的表。
例如,我有以下表格: KEY_VALUE_LKP 包含 LKP_TEXT、LKP_VALUE 和 LKP_TYPE 列 REQUEST_DET 包含 REQUESTNO、USERID 和 REQ_STATUS 列 具有 USERNAME、USERID
REQUEST_DET 列的 USER_DET 与 KEY_VALUE_LKP 相关,其中 REQ_STATUS = LKP_VALUE 和 LKP_TYPE="REQUEST_CRITICALITY" 但此关系未在数据库中定义 REQUEST_DET 与数据库中定义的 USER_DET 具有外键关系,其中 USERID=USERID
当我构建模型时,我得到三个表,并且 USER_DET 与 REQUEST_DET 相关这一事实
使用 FORMVIEW 我绑定到请求数据(REQUEST_DET EntityDataSource)并且可以看到相关表请求的相关信息(USERNAME、REQUESTNO,但我得到了 REQ_STATUS 的数值。
我想做的是检索 LKP_TEXT 值,但看到 KEY_VALUE_LKP 表之间没有定义关系“ EntityDataSource 上的 Include" 属性将不起作用。
我向 WebForm 添加了第二个 EntityDataSource,并将其链接到 KEY_VALUE_LKP 表,并添加了 where="it.LKP_TYPE='REQUEST_CRITICALITY'"。我知道我可以将其绑定到 DropDown并在后面的代码中设置选定的值,但我希望将其绑定到标签而不是下拉列表。
因此,从绑定到 REQUEST_DET EntityDataSource 的表单视图中,我可以将标签绑定到不同的 EntityDataSource 吗?
提前致谢, -J
I am trying to figure out the best way to bind to an unrelated table in .Net. I have an ADO .Net Entity data model which contains several related tables and a few unrelated tables.
For example, I have the following tables:
KEY_VALUE_LKP with columns LKP_TEXT, LKP_VALUE and LKP_TYPE
REQUEST_DET with columns REQUESTNO, USERID, and REQ_STATUS
USER_DET with columns USERNAME, USERID
REQUEST_DET is related to KEY_VALUE_LKP where REQ_STATUS = LKP_VALUE and LKP_TYPE="REQUEST_CRITICALITY" but this relationship not defined in the database
REQUEST_DET is has a foreign key relationship with USER_DET defined in the database where USERID=USERID
When I build my model I get the three tables and the fact that USER_DET is related to REQUEST_DET
Using a FORMVIEW I bind to the Request data (REQUEST_DET EntityDataSource) and can see the relevant information for the request for the related tables (USERNAME, REQUESTNO but I get the numeric value for the REQ_STATUS.
What I would like to do is retrieve the LKP_TEXT value but seeing there is no relationship defined between the KEY_VALUE_LKP table the "Include" attribute on the EntityDataSource will not work.
I added a second EntityDataSource to the WebForm and linked it to the KEY_VALUE_LKP table and added the where Where="it.LKP_TYPE='REQUEST_CRITICALITY'". I know I could bind this to a DropDown and in the code behind set the selected value, but I want this to be bound to a Label not a drop down.
So, from within a form view bound to REQUEST_DET EntityDataSource can I bind a lable to a different EntityDataSource?
Thanks in advance,
-J
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一种使用 Entity SQL 执行此操作的方法,下面是一个类似的示例:
I found a method to do this with Entity SQL, below is a similar example: