Thursday, 29 October 2015

 scenario .
The scenario is consider two tables as student and faculty table.
Student table having below fields.
1.       Student Id.
2.       Student Name.
Faculty table having all the student table fields and below given fields.
1.       Faculty Id.
2.       Faculty Name.
When we insert a field (Student Id) in faculty table, by default the Student Name for the selected Student Id should be inserted.
How to achieve this :
    I created both tables with normal relation.
   Under the faculty table methods I written modified field method to perform automatic insertion of Student Name for the selected Student Id.
The code written for the modified field method is as below.
  Public void modifiedfield(fieldId_fieldid)
  {
  StudentTable st;
  If(_fieldid==fieldnum(st,StudentId))
  Super(_fieldid);
  Select st
  Where st.StudentId==this.StudentId;
  {
  this.SName=st.SName;
  }

 }

No comments:

Post a Comment