vs2005的问题
我的网站建在e:\visual studio\project中。我工程。里面就一个default.aspx(里面就几句代码)
DataSet ds=new DataSet();
ds.ReadXml("Contact.xml");
this.GridView1.DataSource = ds.Tables[0];
this.GridView1.DataBind();
还有一个xml文件
xml没有任何问题。
运行以上程序 会报这样一个错误。
未能找到文件“G:\Program Files\Common7\IDE\Contact.xml”。
我知道是因为网站visual studio里面网站的默认发布路径设置成了我vs2005 的安装路径下
G:\Program Files\Common7\IDE
请问是在哪里修改
--------------------编程问答-------------------- 实在不好意思。。
我的csdn用的少。只是偶尔下载。没分了 --------------------编程问答-------------------- System.Windows.Forms.Application.StartupPath这个代码就是cs程序获取根路径的,你更改一下,看看bs能不能用! --------------------编程问答-------------------- DataSet ds=new DataSet();
//ds.ReadXml("Contact.xml");
ds.ReadXml(Server.MapPath("Contact.xml")//将文件虚拟路径转为物理路径
this.GridView1.DataSource = ds.Tables[0];
this.GridView1.DataBind();
还有一个xml文件
xml没有任何问题。
运行以上程序 会报这样一个错误。 --------------------编程问答-------------------- DataSet ds=new DataSet();
//ds.ReadXml("Contact.xml");
ds.ReadXml(Server.MapPath("Contact.xml"))//将文件虚拟路径转为物理路径
this.GridView1.DataSource = ds.Tables[0];
this.GridView1.DataBind();
还有一个xml文件
xml没有任何问题。
运行以上程序 会报这样一个错误。
补充:.NET技术 , ASP.NET