static string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +Server.MapPath(".") + "..\\Database\\new.mdb";
OleDbConnection olconn=new OleDbConnection(conStr);
错误:System.Web.UI.Page.Server表示属性,此处应为方法如何改?
OleDbConnection olconn=new OleDbConnection(conStr);
错误:System.Web.UI.Page.Server表示属性,此处应为方法如何改?
试试
看看是不是你所要的那个目录
改
"\\Database\\new.mdb";调试看看conStr 里面是什么
LS 大侠们,是编译错误,编译都没通过怎么启动调试?2。
static string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +Server.MapPath(".") + "..\\Database\\new.mdb";
============
如果这段代码再 .aspx.cs 中,那么你无法这样声明并实例化Server 作为 Page 的实例属性,你的Page都还没实例化,怎么会能去调用它的属性?3。》》》 static string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath(".") + "..\\Database\\new.mdb";
Server 作为 Page 的实例属性,你的Page都还没实例化,怎么会能去调用它的属性?
--------------------------------------
不是太明白,请高手能否具体说下呢