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. uploading xml to database

uploading xml to database

Scheduled Pinned Locked Moved C#
helpdatabasexmlannouncementlounge
7 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.
  • K Offline
    K Offline
    kalyan_2416
    wrote on last edited by
    #1

    hi i can upload my xml into database easily but i am getting a problem when the xml tag is a keyword(like desc,double) saying syntax error in insert into command.... in general insert if keyword canbe changed like [keyword] but i am not coming accross insert statement when i am using da.update(table) please help me

    R 1 Reply Last reply
    0
    • K kalyan_2416

      hi i can upload my xml into database easily but i am getting a problem when the xml tag is a keyword(like desc,double) saying syntax error in insert into command.... in general insert if keyword canbe changed like [keyword] but i am not coming accross insert statement when i am using da.update(table) please help me

      R Offline
      R Offline
      Rocky
      wrote on last edited by
      #2

      plz give some code and show us how ur inserting the data

      Rocky You can't climb up a ladder with your hands in your pockets. Follow this rule Arrive. RAISE HELL. Leave.

      K 1 Reply Last reply
      0
      • R Rocky

        plz give some code and show us how ur inserting the data

        Rocky You can't climb up a ladder with your hands in your pockets. Follow this rule Arrive. RAISE HELL. Leave.

        K Offline
        K Offline
        kalyan_2416
        wrote on last edited by
        #3

        have an xml i am able to change into data table and insert into database also... StringReader xmlsr3 = new StringReader(region); dset3.ReadXml(xmlsr3, XmlReadMode.IgnoreSchema); OleDbDataAdapter da3 = new OleDbDataAdapter("select * from drregion", m_Conn); OleDbCommandBuilder cb3 = new OleDbCommandBuilder(da3); da3.Update(dtab3); dtab3 = dset3.Tables[0]; like this it gets updated now the problem is when xml string has a keywords (of databases) while updating into database that is in the last statement there is an error saying insert into syntax error i need to change the ex: keyfield-desc to [desc] (i could nt do it in xml ) there was another error if i do that how can i do this or is there any other way....

        R 1 Reply Last reply
        0
        • K kalyan_2416

          have an xml i am able to change into data table and insert into database also... StringReader xmlsr3 = new StringReader(region); dset3.ReadXml(xmlsr3, XmlReadMode.IgnoreSchema); OleDbDataAdapter da3 = new OleDbDataAdapter("select * from drregion", m_Conn); OleDbCommandBuilder cb3 = new OleDbCommandBuilder(da3); da3.Update(dtab3); dtab3 = dset3.Tables[0]; like this it gets updated now the problem is when xml string has a keywords (of databases) while updating into database that is in the last statement there is an error saying insert into syntax error i need to change the ex: keyfield-desc to [desc] (i could nt do it in xml ) there was another error if i do that how can i do this or is there any other way....

          R Offline
          R Offline
          Rocky
          wrote on last edited by
          #4

          OK so your problem is that you need to enclose the keywords of databases with [] brackets right! I'm giving you an idea, go ahead and try it out store all the available keywords in an string array. then parse the xml you need to insert comparing them with the contents of the array. if you get a match you shuld enclose the matched word with [] when youre done with that, just do whatever you wanna do OK as far as my understanding is concerned its really a string manipulation problem.

          Rocky You can't climb up a ladder with your hands in your pockets.

          K 1 Reply Last reply
          0
          • R Rocky

            OK so your problem is that you need to enclose the keywords of databases with [] brackets right! I'm giving you an idea, go ahead and try it out store all the available keywords in an string array. then parse the xml you need to insert comparing them with the contents of the array. if you get a match you shuld enclose the matched word with [] when youre done with that, just do whatever you wanna do OK as far as my understanding is concerned its really a string manipulation problem.

            Rocky You can't climb up a ladder with your hands in your pockets.

            K Offline
            K Offline
            kalyan_2416
            wrote on last edited by
            #5

            when i do that what is happening is StringReader xmlsr3 = new StringReader(region); dset3.ReadXml(xmlsr3, XmlReadMode.InferSchema); an exception rises saying its a "[" cannot be used here

            R 1 Reply Last reply
            0
            • K kalyan_2416

              when i do that what is happening is StringReader xmlsr3 = new StringReader(region); dset3.ReadXml(xmlsr3, XmlReadMode.InferSchema); an exception rises saying its a "[" cannot be used here

              R Offline
              R Offline
              Rocky
              wrote on last edited by
              #6

              hmm well in taht case i think we do have a little situation here. calling an XML experienced customer here!!

              Rocky You can't climb up a ladder with your hands in your pockets.

              K 1 Reply Last reply
              0
              • R Rocky

                hmm well in taht case i think we do have a little situation here. calling an XML experienced customer here!!

                Rocky You can't climb up a ladder with your hands in your pockets.

                K Offline
                K Offline
                kalyan_2416
                wrote on last edited by
                #7

                kkkkkk thanxs

                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