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
Rahul Lakshakar
NA
199
41.8k
Add new row in xml file using asp.net c#
Apr 4 2017 3:35 AM
Hello.
I am trying to add new row in xml file but my code is not working can any guide me about my code?
my back end code is:
DataSet Xds = new DataSet();
Xds.ReadXml(Server.MapPath("~/Student_ExamPaper_xml/" + Student_Question_paper_xml + ".xml"));
DataRow Xrow = Xds.Tables[0].NewRow();
Xrow["Question_ID"] = "Question_" + question_id;
Xrow["Question_detail"] = Question_detail.Text;
Xrow["Option_1"] = Question_detail.Text;
Xrow["Option_2"] = Question_detail.Text;
Xrow["Option_3"] = Question_detail.Text;
Xrow["Option_4"] = Question_detail.Text;
Xrow["Radion_Button_index"] = Question_detail.Text;
Xds.Tables[0].Rows.Add(Xrow);
Xds.AcceptChanges();
Xds.WriteXml(Server.MapPath("~/Student_ExamPaper_xml/" + Student_Question_paper_xml + ".xml"));
and xml fomrat:
<Questions>
<Question_1>
<Question_ID>1</Question_ID>
<Question_Detail>What is the capital of INDIA?</Question_Detail>
<Option_1>Mumbai</Option_1>
<Option_2>Ranchi</Option_2>
<Option_3>Delhi</Option_3>
<Option_4>Kanpur</Option_4>
<Radion_Button_index>-1</Radion_Button_index>
</Question_1>
</Questions>
Please Guide me.... thanks in advance
Reply
Answers (
1
)
search-in-Asp-Net-mvc-5-using-ado-net
Using Toastr notification in mvc