猿问

C#验证XML文件登录问题

<?xml version="1.0" encoding="gb2312"?><ShowList> <Movie> <user>admin</user> <password>1</password> </Movie> <Movie> <user>aa</user> <password>2</password> </Movie> <Movie> <user>ww</user> <password>ww</password> </Movie></ShowList>




绝地无双
浏览 713回答 2
2回答

慕的地6264312

1XmlNodeList&nbsp;usersList&nbsp;=&nbsp;xmlDoc.SelectNodes("//Movie/user");这一句你已经选择了所有user节点,而你又在user节点下去获取user和password,显然不行所以改成1XmlNodeList&nbsp;usersList&nbsp;=&nbsp;xmlDoc.SelectNodes("//Movie");这样就好了,另外1if&nbsp;(comboBox1.Equals(usersList[i].SelectSingleNode("user").InnerText)&nbsp;&&&nbsp;textBox1.Equals(usersList[i].SelectSingleNode("password").InnerText))这一句有问题,应该是1comboBox1.Text.Equals...&&&nbsp;textBox1.Text.Equals...

繁花不似锦

password是user的同级节点,是Movie的子节点,不是user的子节点
随时随地看视频慕课网APP

相关分类

Html5
我要回答