You are creating a windows forms application. You are using a typed Dataset that consist of two typed Data table that maintains a parent – child relationship. The parent table is named as dtParent and the child table as dtChild. If you do as
you get the exception
System.InvalidCastException: Unable to cast object of type ' dtParent Row[]' to type ' dtChild Row[]'.
The dataset.xsd file looks as under
<msdata:Relationship name=" dtParent _ dtChild " msdata:parent=" dtParent " msdata:child="ReqDetail" msdata:parentkey="ID" msdata:childkey="ID" msprop:Generator_UserRelationName=" dtParent _ dtChild " msprop:Generator_RelationVarName="relation dtParent _ dtChild " msprop:Generator_UserChildTable=" dtChild " msprop:Generator_UserParentTable=" dtParent " msprop:Generator_ParentPropName=" dtParent Row" msprop:Ge

 Posted by Niladri.Biswas on 2/3/2013 | Category: C# Interview questions | Views: 6208 | Points: 40
Select from following answers:
  1. The Id column of child table and parent table has different data types.
  2. The child table has no rows
  3. The parent table has no rows.
  4. The constraint being defined in the relationship is wrong.
  5. All Above

Show Correct Answer

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response