I downloaded the Survey Sample and Survey Admin Sample from MSDN's Code Centre two years ago and have been using it regularly since with Windows 2000 Server, IIS 5.0 and the .NET Framework 1.0. However, I am unable to port the Survey solution to a new production Web server, running Windows Server 2003, IIS 6.0 and the .NET Framework 1.1, due to a error when setting the Nested property of a DataRelation to true in the AdjustQuestionPrimaryKey() sub-routine ("A column named 'Answer' already belongs to this DataTable: cannot set a nested table name to the same name"). There are a few reports of a similar issue elsewhere on the Web but I have yet to find any that refer to a satisfactory resolution. Given that the Survey and Survey Admin samples appear to have disappeared relatively recently from MSDN, I was wondering whether anyone can offer an explanation for this occurrence or, alternatively (and preferably!), has a solution to the problem. I should add that I have yet to apply service pack 1 for the .NET Framework 1.1 but did not notice any documented connection between the issues that it addresses and the difficulty I have reported.
Regards
GazHi Gaz,
Yeah, I had it removed as too many people were having problems with it, and I didn't have the time to go through the code and fix all of the migration issues. There was one fix I did that may work for you, however. In the response.xsd file, change the definition of Answer from:
<xs:element name="Answer" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="Id" form="unqualified" type="xs:int" />
<xs:attribute name="Text" form="unqualified" type="xs:string" />
</xs:complexType>
</xs:element
to a complex type with a different name. Actually, here's the whole file:
<?xml version="1.0" ?>
<xs:schema id="NewDataSet" targetNamespace="http://tempuri.org/SampleResponse.xsd"
xmlns:mstns="http://tempuri.org/SampleResponse.xsd"
xmlns="http://tempuri.org/SampleResponse.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xs:complexType name="AnswerType">
<xs:attribute name="Id" form="unqualified" type="xs:int" />
<xs:attribute name="Text" form="unqualified" type="xs:string" />
</xs:complexType>
<xs:element name="SurveyResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Question" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Answer" minOccurs="0" maxOccurs="unbounded" type="AnswerType" />
</xs:sequence>
<xs:attribute name="Id" form="unqualified" type="xs:int" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Id" form="unqualified" type="xs:string" />
</xs:complexType>
<xs:key name="SurveyResponseQuestionKey" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Question" />
<xs:field xpath="@.Id" />
</xs:key>
<xs:key name="SurveyResponseAnswerKey" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Answer" />
<xs:field xpath="@.Id" />
</xs:key>
<xs:key name="SurveyResponseKey1" msdata:PrimaryKey="true">
<xs:selector xpath=".//Question" />
<xs:field xpath="@.Id" />
</xs:key>
<xs:key name="SurveyResponseKey2" msdata:PrimaryKey="true">
<xs:selector xpath=".//Answer" />
<xs:field xpath="@.Id" />
</xs:key>
</xs:element>
<xs:element name="BaseResponseDataSet" msdata:IsDataSet="true" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="SurveyResponse" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema
Alternately, you might want to look at nSurvey, which is a full featured survey application.
0 comments:
Post a Comment