System.Data.EvaluateException:找不到列[B100]. [英] System.Data.EvaluateException: Cannot find column [B100].

查看:309
本文介绍了System.Data.EvaluateException:找不到列[B100].的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我像这样在查询字符串中传递类别和imgId..

http://localhost:56393/FunEvilModi/ViewItem.aspx?Cat = Birthday& ImgId = B100 [ ^ ]

在页面lode

i pass category and imgId in the query string like this..

http://localhost:56393/FunEvilModi/ViewItem.aspx?Cat=Birthday&ImgId=B100[^]

in page lode

DataSet DSImages = new DataSet();
DSImages.ReadXml(Server.MapPath(@"~\\xml\\"+Request.QueryString[0].ToString()+".xml"));

\\This line Gives Error
DataRow DRow  = DSImages.Tables[0].Select("imgId=" + Request.QueryString[1].ToString())[0];

\\This line gives error
ImgItem.ImageUrl = "~/greetings/"+DRow[1].ToString();


在XML文件中,我存储了ImgId,IMgURL
我想基于imgId显示图像

它给出了这样的错误

异常详细信息:System.Data.EvaluateException:找不到列[B100]."


In XML file i store the ImgId,IMgURL
i want display the image based on imgId

it Gives error like this

"Exception Details: System.Data.EvaluateException: Cannot find column [B100]."

推荐答案

Rajesh Kumar Chekuri写道:
Rajesh Kumar Chekuri wrote:

DataRow DRow = DSImages.Tables [0] .Select("imgId =" + Request.QueryString [1] .ToString())[0];

DataRow DRow = DSImages.Tables[0].Select("imgId=" + Request.QueryString[1].ToString())[0];



您需要在单引号内传递值

DSImages.Tables[0].Select(string.Format("imgId=''{0}''", Request.QueryString[1].ToString())[0]);




You need to pass the value within single quotes

DSImages.Tables[0].Select(string.Format("imgId=''{0}''", Request.QueryString[1].ToString())[0]);


Rajesh Kumar Chekuri写道:
Rajesh Kumar Chekuri wrote:

Server.MapPath(@〜\\ xml \\" + Request.QueryString [0] .ToString()+ ".xml"));

Server.MapPath(@"~\\xml\\"+Request.QueryString[0].ToString()+".xml"));



您不必像指定@一样指定\\.如果您使用string.Format(@"~\xml\{0}.xml", Request.QueryString[0].ToString());.



You need not specify \\ as you have given @. Also it would make it easier to read if you used string.Format(@"~\xml\{0}.xml", Request.QueryString[0].ToString());.


这篇关于System.Data.EvaluateException:找不到列[B100].的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆