When you have parent-child tables and you wish to use a DetailsView to edit the data how do you do it using a SqlDataSource?
如果您有父子表并且希望使用DetailsView编辑数据,那么如何使用SqlDataSource执行此操作?
For example, if you have a Person and an Employee table (where an employee is the child table and the Person is parent table - an employee derives from a person). Person P_ID FirstName LastName DOB Employee E_ID P_ID EmployeedID Title HireDate
例如,如果您有一个Person和一个Employee表(其中一个雇员是子表,而Person是父表 - 一个雇员来自一个人)。 Person P_ID FirstName LastName DOB Employee E_ID P_ID EmployeedID Title HireDate
- The SQL statement returns all the information for the employee (First and Last Name, DOB, EmployeeID, Title, HireDate).
- User should be able to edit and insert an employee using a single DetailsView, instead of 2 DetailsView (one for Person and the other for employee)
- When inserting, the record for person should be created first and then the ID assigned to employee)
SQL语句返回员工的所有信息(名字和姓氏,DOB,员工ID,标题,HireDate)。
用户应该能够使用单个DetailsView编辑和插入员工,而不是2个DetailsView(一个用于Person,另一个用于员工)
插入时,应首先创建人员记录,然后分配给员工的ID)
So how does one go about doing this? 1. Using a SQLDataSource 2. Using a DataSet
那怎么去做呢? 1.使用SQLDataSource 2.使用DataSet
1 个解决方案
#1
1
Does this answer your question: http://msdn.microsoft.com/en-us/library/aa581796.aspx ?
这是否回答了您的问题:http://msdn.microsoft.com/en-us/library/aa581796.aspx?
#1
1
Does this answer your question: http://msdn.microsoft.com/en-us/library/aa581796.aspx ?
这是否回答了您的问题:http://msdn.microsoft.com/en-us/library/aa581796.aspx?