本文介绍了关于LINK to SQL的简单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我需要建立一个基于SQL Server 2005表格的直接管理网站。我需要向我的客户提供一个简单的界面才能编辑某些表格数据库的某些字段。

为此我开始从VS2008开始探索动态数据网站模板。
我用我的数据库中只有2个测试表定义了我的实体模型。我注意到的第一件事是模型没有在设计上进行任何协调,所以我需要手动添加它们

然后基于我需要在我选择一个特定的表时编辑,如果表引用子表中的其他字段,那么我希望用户想要编辑的字段用子表中的预定义选项填充,这个sin命令可以避免在定义选择时出错。

让我解释一下:

表A基于BOOKS并定义为:

身份证号码:PK
标题:书名
Author_Id

表B是已知的AUTHO RS并定义为:

ID:PK
名称:作者姓名

那么我想要的是当在BOOKS表中添加新书时,我的用户将会必须输入一个他不知道要放置什么的Author_Id。相反,我希望在版本期间,一个组合框中填充了来自AUTHOR故事的UAthor_name,就像显示可能的作者选择一样,当保存到Db时,ID仅作为参考保存在Db中。另一种可能性是我的用户有一个列表框条目,它选择作者姓名,然后wuerry将只返回所选作者的书。

如何定义实体模型关联为了能够将组合框或列表框绑定到子字段?

提供帮助的权利要求俚语


您的经验是建立的来自其他人之一

Dear all,

I need to build a straight forward administration web site based on SQL server 2005 tables
I need to offer to my customer a simple interface in order to Edit certain table and certain Field of the database.

For that I start to explore the Dynamic Data web site template from VS2008.
I defined my Entity model with only 2 test table from my database.

First thing i notice is that the model did not place any accociation on the design so I need to add them manually

Then based on that I need that when I select a particular table to Edit, if the table refer some other field in a child table, then I would like that the field which the user is suppose to edit is filled with predifined choice from the child table, this sin order to avoid mistaked when selection is defined.

Let me explain :

Table A is based on BOOKS and defined as  :

ID : PK
Title : book title
Author_Id

Table B is the known AUTHORS and defined as :

ID : PK
Name :Author Name

Then What I would like is that when Adding new books in BOOKS table, my user will have to enter an Author_Id which he has no idea of what to palce it. Instead I would like that during edition, A combo box is filled up with UAthor_name from AUTHOR tale, just as display a possible selection of authors and when save to Db, the ID only will be saved in Db as reference.

An other possibility wold be that my User has a List box entry where it select the Authors name and then the wuerry will return only book of that selected Authors.

How to define the Entity model association in order that I could bind the combo box or list box to the child field ?

Thnaks for help
ragards
serge


Your experience is build from the one of others

推荐答案


这篇关于关于LINK to SQL的简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 21:26