in Education by
Q: I allow my user to upload an xml file to insert its contents in my database. I ask if there's some idea to know the attributes which have been changed to update the equivalent fields in my database without uploading the updated file again(clear all the data related to this file and insert it again). Is there some way rather than a form . My xml snip: My .cs snip : List days = new List();//List of days. IEnumerable resultDays = ReadDayNodes(targetFileName); foreach (DayNode name in resultDays) { Day day = new Day(); if (!string.IsNullOrEmpty(ddl_batch.SelectedValue)) day.BatchNum = int.Parse(ddl_batch.SelectedValue); if (!string.IsNullOrEmpty(ddl_department.SelectedValue)) day.DepCode = int.Parse(ddl_department.SelectedValue); if (!string.IsNullOrEmpty(ddl_study.SelectedValue)) day.StudyCode = int.Parse(ddl_study.SelectedValue); if (!string.IsNullOrEmpty(name.Day)) day.DayId = name.Day; day.ShortName = name.Short; day.Name = name.Name; days.Add(day); } /********************************************************************************************************************/ private struct DayNode { public string Name { get; private set; } public string Short { get; private set; } public string Day { get; private set; } public DayNode(string Name, string Short, string Day) : this() { this.Name = Name; this.Short = Short; this.Day = Day; } } /********************************************************************************************************************/ private static IEnumerable ReadDayNodes(string filePath) { using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) using (XmlReader xrdr = new XmlTextReader(fs)) while (xrdr.Read()) if (xrdr.NodeType == XmlNodeType.Element && xrdr.LocalName == "day") yield return new DayNode(xrdr.GetAttribute("name"), xrdr.GetAttribute("short"), xrdr.GetAttribute("day")); } /********************************************************************************************************************/ resultDay = CommonUitilities.InsertDays(days); JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You may pass InputStream (FileUpload#PostedFile) object of uploaded file to the XDocument.Load() method (Linq-XML) to read/parse XML document. After that you may compare xml data against the database.

Related questions

0 votes
    Q: I allow my user to upload an xml file to insert its contents in my database. I ask if there' ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Q: I allow my user to upload an xml file to insert its contents in my database. I ask if there' ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I have to unmarshall a XML(XML version 1) to get the values and put these ones in a new version ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    This is a sample (edited slightly, but you get the idea) of my XML file: Test 192.168.1.1 Test ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I have an XML file which is structured as follows: place1 location1 place2 location2 place3 location3 These ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I'm trying to access my .xml file in the ClientBin with no success. code: WebClient xmlClient = ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I am currently exploring powershell. I like the way I can mount everything, for example the registry, so ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    The face attributes of tag is used to specify the name of the font. True or false no spam messages plzz… Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    I've got a problem similar to this question: SAXParseException localized I'm trying to parse a XML file ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    Rather than rewriting the entire contents of an xml file when a single element is updated, is there a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 26, 2022 in Education by JackTerrance
0 votes
    Explain how XML file is called in d3.js?...
asked Nov 14, 2020 in Technology by JackTerrance
0 votes
    I am reading a yaml file like so in Python3: def get_file(): file_name = "file.yml" properties_stream ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    In _________ model, the configuration server automatically sends the updated configuration file if there is any change. 1. Both the options 2. Push 3. Pull...
asked Sep 18, 2021 in Technology by JackTerrance
0 votes
    strong text [Plugin error at Note entity][1] [1]: Hi,Anyone ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I'm trying to import an XML file via a web page in a Ruby on Rails application, the code ruby ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
...