Programmatically Update Excel File's SQL 'command' Attribute RRS feed

  • Question

  • Greetings, using c# openxml - I am attempting to open an excel file, bind to its connection.xml stream, and update the embedded SQL query. I am able to successfully replace individual character sequences withing the connection/command node, but attempting to explicitly set the command attribute (i.e. node.Attribute["command"].Value = select * from ....) is resulting in a corrupted, poorly formed connection.xml file.


                            csNode = xmlDoc.SelectSingleNode("*/*/*[@connection]");

                            csNode.Attributes["command"].Value = newQry;



    Although, I'm POSITIVE it worked at one time - it seems to be consistently failing now. Does it require a special format - example documentation would be ideal!

    Any assistance would be greatly appreciated!

    Tuesday, November 13, 2012 2:29 PM


All replies