求助xml的读取问题 - .NET技术 / C#
我想建一个数组strs保存来自XMLFile1.xml的相关数据。数组最后是用来给combobox选择用的
这是我用来模糊查询用的: XmlDataDocument _xmlData = null;
XmlNodeList _xmlNodeList = null;
try
{
string xmlFile = Application.StartupPath + "\\XMLFile1.xml";
_xmlData = new XmlDataDocument();
_xmlData.Load(xmlFile);
string xpath = "//lines";
if (textBox1.Text != "")
{
xpath += "[contains(name,'{0}')]";
xpath = String.Format(xpath, this.textBox1.Text);
}
这是关联combobox的代码:
if (this.comboBox1.Text == "aaa")
{
this.comboBox2.Items.Clear();
comboBox2.Items.Add("选择");
string[] temp =strs[0].Split(',');
for (int i = 0; i < temp.Length; i++)
comboBox2.Items.Add(temp[i]);
}
XMLFile1.xml如下:
<?xml version="1.0" encoding="utf-8" ?>
<bus>
<linestops>
<!-- 站点路线 --&
相关问答:
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' 打开刚创建的文件。
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' 读入所有字符到变量中 ......
如何用ATL窗体应用程序中用System.Xml遍历一个Xml文件
你说的是托管代码?
。
vc可用msxml
http://msdn.microsoft.com/en-us/library/ms767594(VS.85).aspx
MSXML4
//引入msxml4.dll &nbs ......
思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
<time times='01:12:00' timee='02:30:00'> ......
使用ACCESS最大的隐患就是不安全。今天对ACCESS数据库设置了一个密码,必须使用密码才能打开,但是在程序中却无法连接数据库了。大家知道使用用户名和密码,如何连接ACCESS数据库?貌似ACCESS的用户名还不知道?只知 ......