Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. pls correct the error in this part of the program

pls correct the error in this part of the program

Scheduled Pinned Locked Moved C#
xmlhelpdatabasedata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dhol
    wrote on last edited by
    #1

    Hi I have done a program , here The program reads any xml schema file and automatically writes 200 data's to a xml file(name as result.xml)according to their data types. say for string-john1, john2,john3...etc.. say for decimal-101.20, 102.20, 103.20 ..etc.. so on. And the program also reads a xml file with single field named address(for ex:) . so the program what it does is checks the schema file whether there is any element named "address" and it stores the fieldnumber(position of the field) and the field name in an array. then the program reads a another input xml file(which has address values ). then it stores the values from the input xml file into the resultxml I have done it and I am coming across some errors.I will paste the part of the program what I did.. Please help me to sort out the error. private void button2_Click(object sender, System.EventArgs e) { ArrayList FiledNames = new ArrayList(); ArrayList MatchList = new ArrayList(); XmlTextReader xtr = new XmlTextReader(@"C:\CDEV\testdatagenerator\FIELDNAMES.xml"); while (xtr.Read()) { switch (xtr.NodeType) { case XmlNodeType.Element: FiledNames.Add(xtr.Name); break; } } xtr.Close(); XmlDocument xdc = new XmlDocument(); xdc.Load(@"C:\CDEV\testdatagenerator\vw_forecast.xml"); dataSet1.ReadXmlSchema(txtSchema.Text); foreach (DataTable dTbl in dataSet1.Tables) { int i = 0; object[] oValues = new object[dTbl.Columns.Count]; xdc.Load(@"C:\CDEV\testdatagenerator\FIELDNAMES.xml"); foreach (DataColumn dColmn in dTbl.Columns) { for (int y=0; y

    D 1 Reply Last reply
    0
    • D dhol

      Hi I have done a program , here The program reads any xml schema file and automatically writes 200 data's to a xml file(name as result.xml)according to their data types. say for string-john1, john2,john3...etc.. say for decimal-101.20, 102.20, 103.20 ..etc.. so on. And the program also reads a xml file with single field named address(for ex:) . so the program what it does is checks the schema file whether there is any element named "address" and it stores the fieldnumber(position of the field) and the field name in an array. then the program reads a another input xml file(which has address values ). then it stores the values from the input xml file into the resultxml I have done it and I am coming across some errors.I will paste the part of the program what I did.. Please help me to sort out the error. private void button2_Click(object sender, System.EventArgs e) { ArrayList FiledNames = new ArrayList(); ArrayList MatchList = new ArrayList(); XmlTextReader xtr = new XmlTextReader(@"C:\CDEV\testdatagenerator\FIELDNAMES.xml"); while (xtr.Read()) { switch (xtr.NodeType) { case XmlNodeType.Element: FiledNames.Add(xtr.Name); break; } } xtr.Close(); XmlDocument xdc = new XmlDocument(); xdc.Load(@"C:\CDEV\testdatagenerator\vw_forecast.xml"); dataSet1.ReadXmlSchema(txtSchema.Text); foreach (DataTable dTbl in dataSet1.Tables) { int i = 0; object[] oValues = new object[dTbl.Columns.Count]; xdc.Load(@"C:\CDEV\testdatagenerator\FIELDNAMES.xml"); foreach (DataColumn dColmn in dTbl.Columns) { for (int y=0; y

      D Offline
      D Offline
      David Levitt Myrddin
      wrote on last edited by
      #2

      At a quick glance I noticed that your first "for" loop is incorrect..... What is the exception you're getting?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups