我想要查询部分属性。因为。要用到的只有两个。。不想用findall,那样。一些多余的也查出来了。
所以就用以方式来查询。结果老是出现。下面错误。数组中至少一个元素不能被转。。急啊。。高手们帮帮忙啊。。 protected void Band()
{
SimpleQuery query = new SimpleQuery(typeof(Protype),typeof(string),@"select protype.Pcontent,protype.Pico from Protype protype where protype.Id=:end ");
query.SetParameter("end",21);
String[] Flist =(string[])Protype.ExecuteQuery(query);
lblyuanqu.Text = Common.Common.DisLength(Flist[0][0].ToString(), 50);
Fimg = Flist[0][1].ToString();
}“/bbrj-07-21”应用程序中的服务器错误。
--------------------------------------------------------------------------------源数组中至少有一个元素无法被向下转换到目标数组类型。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidCastException: 源数组中至少有一个元素无法被向下转换到目标数组类型。源错误:
行 24: SimpleQuery query = new SimpleQuery(typeof(Protype),typeof(string),@"select protype.Pcontent,protype.Pico from Protype protype where protype.Id=:end ");
行 25: query.SetParameter("end",21);
行 26: String[] Flist =(string[])Protype.ExecuteQuery(query);
行 27: lblyuanqu.Text = Common.Common.DisLength(Flist[0][0].ToString(), 50);
行 28: Fimg = Flist[0][1].ToString();
源文件: d:\大项目区\bbrjr\bbrj-07-21\Bryuanqu.aspx.cs 行: 26 堆栈跟踪:
[InvalidCastException: 源数组中至少有一个元素无法被向下转换到目标数组类型。]
System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) +0
System.Collections.ArrayList.CopyTo(Array array, Int32 arrayIndex) +50
Castle.ActiveRecord.Framework.SupportingUtils.BuildArray(Type type, IEnumerable list, Int32 entityIndex, Boolean distinct) +523
Castle.ActiveRecord.Queries.SimpleQuery.InternalExecute(ISession session) +47
Castle.ActiveRecord.ActiveRecordBaseQuery.Castle.ActiveRecord.IActiveRecordQuery.Execute(ISession session) +7
Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery query) +78[ActiveRecordException: Could not perform ExecuteQuery for Protype]
Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery query) +192
Bryuanqu.Band() in d:\大项目区\bbrjr\bbrj-07-21\Bryuanqu.aspx.cs:26
Bryuanqu.Page_Load(Object sender, EventArgs e) in d:\大项目区\bbrjr\bbrj-07-21\Bryuanqu.aspx.cs:17
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
所以就用以方式来查询。结果老是出现。下面错误。数组中至少一个元素不能被转。。急啊。。高手们帮帮忙啊。。 protected void Band()
{
SimpleQuery query = new SimpleQuery(typeof(Protype),typeof(string),@"select protype.Pcontent,protype.Pico from Protype protype where protype.Id=:end ");
query.SetParameter("end",21);
String[] Flist =(string[])Protype.ExecuteQuery(query);
lblyuanqu.Text = Common.Common.DisLength(Flist[0][0].ToString(), 50);
Fimg = Flist[0][1].ToString();
}“/bbrj-07-21”应用程序中的服务器错误。
--------------------------------------------------------------------------------源数组中至少有一个元素无法被向下转换到目标数组类型。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidCastException: 源数组中至少有一个元素无法被向下转换到目标数组类型。源错误:
行 24: SimpleQuery query = new SimpleQuery(typeof(Protype),typeof(string),@"select protype.Pcontent,protype.Pico from Protype protype where protype.Id=:end ");
行 25: query.SetParameter("end",21);
行 26: String[] Flist =(string[])Protype.ExecuteQuery(query);
行 27: lblyuanqu.Text = Common.Common.DisLength(Flist[0][0].ToString(), 50);
行 28: Fimg = Flist[0][1].ToString();
源文件: d:\大项目区\bbrjr\bbrj-07-21\Bryuanqu.aspx.cs 行: 26 堆栈跟踪:
[InvalidCastException: 源数组中至少有一个元素无法被向下转换到目标数组类型。]
System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) +0
System.Collections.ArrayList.CopyTo(Array array, Int32 arrayIndex) +50
Castle.ActiveRecord.Framework.SupportingUtils.BuildArray(Type type, IEnumerable list, Int32 entityIndex, Boolean distinct) +523
Castle.ActiveRecord.Queries.SimpleQuery.InternalExecute(ISession session) +47
Castle.ActiveRecord.ActiveRecordBaseQuery.Castle.ActiveRecord.IActiveRecordQuery.Execute(ISession session) +7
Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery query) +78[ActiveRecordException: Could not perform ExecuteQuery for Protype]
Castle.ActiveRecord.ActiveRecordBase.ExecuteQuery(IActiveRecordQuery query) +192
Bryuanqu.Band() in d:\大项目区\bbrjr\bbrj-07-21\Bryuanqu.aspx.cs:26
Bryuanqu.Page_Load(Object sender, EventArgs e) in d:\大项目区\bbrjr\bbrj-07-21\Bryuanqu.aspx.cs:17
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
解决方案 »
- ██ 高效率图片批量缩小、压缩源代码发布!
- asp.net在WEB页面怎样实现视频聊天还有语音
- 有时加了个文件后有下划虚线点上去说:missing xml comment for publicly visible type or number..
- 关于页面传值 恶意加单引号问题
- 急!在线等待!asp.net上传文件自动解压缩
- 用ASP怎么写输入输出流
- 为什么datalist的itemcreated事件里生成的datalist的id固定不了,总是要带上父datalist的id
- ####问--小山--和各位朋友--关于ScriptX报表问题#####
- Access数据库问题,有谁能帮我?
- IEWebControls.exe如何使用由没有中文帮助?
- 这个sql怎么写
- 只显示分和秒
明显是错误的, 断点看一下返回结果的类型再做下去
query.SetParameter("end",21);
String[] Flist =(string[])Protype.ExecuteQuery(query);[[/code]typeof(string)就是指定的返回类型