问题描述
我像这样在查询字符串中传递类别和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]."
推荐答案
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 quotesDSImages.Tables[0].Select(string.Format("imgId=''{0}''", Request.QueryString[1].ToString())[0]);
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].的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!