TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jo lu
NA
3
0
An item with the same key has already been added. HELP!!!!!
Jan 10 2010 1:23 PM
Gurus
I get this error after I add the first name: Code Below
and xml file below too
public
XmlDocument
AddUsers(
string
queryXml)
{
try
{
Dictionary
<
string
,
string
> fields =
new
Dictionary
<
string
,
string
>();
for
(
int
i = 1; i < 11; i++)
{
XmlDocument
xmlDocument =
new
XmlDocument
();
try
{
xmlDocument.LoadXml(queryXml);
}
catch
(
Exception
)
{
throw
new
Exception
(
"Error reading query string passed to AddUsers Web Service. It may not be a well formed XML."
);
}
fields.Add(
"FirstName"
,
Util
.GetXPath(xmlDocument,
"//FirstName"
+ i.ToString()));
fields.Add(
"MiddleName"
,
Util
.GetXPath(xmlDocument,
"//MiddleName"
+ i.ToString()));
fields.Add(
"LastName"
,
Util
.GetXPath(xmlDocument,
"//LastName"
+ i.ToString()));
fields.Add(
"DisplayName"
,
Util
.GetXPath(xmlDocument,
"//DisplayName"
+ i.ToString()));
fields.Add(
"LoginName"
,
Util
.GetXPath(xmlDocument,
"//Login"
+ i.ToString()));
fields.Add(
"Password"
,
Util
.GetXPath(xmlDocument,
"//Password"
+ i.ToString()));
fields.Add(
"ArchiveStatus"
,
"False"
);
Inserter
inserter =
new
Inserter
(
"DOCUMENTS_PEOPLE"
);
foreach
(
string
key
in
fields.Keys)
{
inserter[key] = fields[key].ToString();
}
}
XmlDocument
xmlReturnDoc =
new
XmlDocument
();
XmlDeclaration
xmlDeclaration = xmlReturnDoc.CreateXmlDeclaration(
"1.0"
,
"utf-8"
,
null
);
XmlElement
rootNode = xmlReturnDoc.CreateElement(
"AddSysOptions"
);
xmlReturnDoc.InsertBefore(xmlDeclaration, xmlReturnDoc.DocumentElement);
XmlNode
NewNode = xmlReturnDoc.AppendChild(rootNode);
NewNode.InnerText =
"Success"
;
return
xmlReturnDoc;
}
catch
(
Exception
ex)
{
AcXmlClasses
.AddLogEntry(
"Error when calling AddUsers: "
+ ex.ToString(), 1);
return
AcException
.GetXmlException(ex);
}
}
<User><FirstName1>fn1</FirstName1><MiddleName1>mn1</MiddleName1><LastName1>ln1</LastName1><DisplayName1>fn1 mn1 ln1</DisplayName1><Login1>AF4073</Login1><Password1>5F4DCC3B5AA765D61D8327DEB882CF99</Password1><FirstName2>fn2</FirstName2><MiddleName2>mn2</MiddleName2><LastName2>ln2</LastName2><DisplayName2>fn2 mn2 ln2</DisplayName2><Login2>AC4070</Login2><Password2>5F4DCC3B5AA765D61D8327DEB882CF99</Password2><FirstName3>fn3</FirstName3><MiddleName3>mn3</MiddleName3><LastName3>ln3</LastName3><DisplayName3>fn3 mn3 ln3</DisplayName3><Login3>AJ4077</Login3><Password3>5F4DCC3B5AA765D61D8327DEB882CF99</Password3><FirstName4>fn4</FirstName4><MiddleName4>mn4</MiddleName4><LastName4>ln4</LastName4><DisplayName4>fn4 mn4 ln4</DisplayName4><Login4>AE4072</Login4><Password4>0CC175B9C0F1B6A831C399E269772661</Password4><FirstName5>fn5</FirstName5><MiddleName5>mn5</MiddleName5><LastName5>ln5</LastName5><DisplayName5>fn5 mn5 ln5</DisplayName5><Login5>AF4073</Login5><Password5>9E3669D19B675BD57058FD4664205D2A</Password5><FirstName6/><MiddleName6/><LastName6/><DisplayName6/><Login6/><Password6/><FirstName7/><MiddleName7/><LastName7/><DisplayName7/><Login7/><Password7/><FirstName8/><MiddleName8/><LastName8/><DisplayName8/><Login8/><Password8/><FirstName9/><MiddleName9/><LastName9/><DisplayName9/><Login9/><Password9/><FirstName10/><MiddleName10/><LastName10/><DisplayName10/><Login10/><Password10/><FirstName11/><MiddleName11/><LastName11/><DisplayName11/><Login11/><Password11/><ArchiveStatus/><ROLES><Role>Student</Role></ROLES></User>
Reply
Answers (
1
)
use of Interface
Changing visual Studio Menu Style