can't get two connecting strings from XML (web.config)

Posted by nCdy on Stack Overflow See other posts from Stack Overflow or by nCdy
Published on 2010-05-26T11:19:02Z Indexed on 2010/05/26 11:21 UTC
Read the original article Hit count: 251

Filed under:
|
|
            XmlTextReader reader = new XmlTextReader(Window1.cfg.FSAddress);
            bool[] startreading = {false , false};
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:    // ???? ???????? ?????????.
                        if (startreading[0])
                        {
                            if (reader.Name == "add")
                                if (startreading[1])
                                {
                                    id2.Text = reader.GetAttribute(1);
                                    return;
                                }
                                else
                                {
                                    id1.Text = reader.GetAttribute(1);
                                    startreading[1] = true;
                                    startreading[0] = false;
                                }
                        }
                        else
                        if (reader.Name == "connectionStrings")
                            startreading[0] = true;
                        break;
                    case XmlNodeType.EndElement:
                        if (startreading[1])
                            if (reader.Name == "add")
                                startreading[0] = true;
                        break;
                }
            }

I take first one but ... then happens something strange and I'm missing second

sorry for my english . btw - Im getting it not from web project.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET