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