怎么改呢?
编译错误:
无法将类型“object”隐式转换为“System.Data.DataView”。存在一个显式转换(是否缺少强制转换?)
DataView dv = Application[ "JinE "];//这一句为红色;
GridView1.DataSource = dv;
GridView1.DataBind();
.aspx.cs代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Application_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataView dv = Application[ "JinE "];//红色
GridView1.DataSource = dv;
GridView1.DataBind();
}
}
Global.asax
<%@ Application Language= "C# " %>
<script runat= "server ">
void Application_Start(object sender, EventArgs e)
{
// 在应用程序启动时运行的代码
System.Data.DataSet ds=new System.Data.DataSet();
ds.ReadXml(Server.MapPath( "客户的订货总金额.xml "));
System.Data.DataView dv = new System.Data.DataView(ds.Tables[ "客户的订货总金额 "]);
Application[ "JinE "] = dv;
}
</script>
------解决方案--------------------------------------------------------
DataView dv =(DataView) Application[ "JinE "];
*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783
------解决方案--------------------------------------------------------
DataView dv = (DataView)Application[ "JinE "];
------解决方案--------------------------------------------------------
DataView dv =(DataView) Application[ "JinE "];//Application[ "JinE "]是Object类型
------解决方案--------------------------------------------------------
加个DataView进行强制转换,同上