错误信息是:列“”不属于表“,即使它存在于该表和查询
类型的异常‘System.Web.HttpUnhandledException’被抛出 友好的消息: System.ArgumentException:Column'testfile'does does not belong to table。在System.Data.DataRow.GetDataColumn(String columnName)at Registration_test.FillImage()in c在System.Data.DataRow.get_Item(String columnName)上不存在 c :\ inetpub \ wwwroot \ testWeb \ Events \ Registration.aspx.cs:第49行 Registration_test.Page_PreInit(Object sender,EventArgs e)in c:\ inetpub \ wwwroot \ testWeb \ test \ Registration.aspx.cs:第39行 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,Object o,Object t,EventArgs e)at System.Web .Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)at System.Web.UI.Page.OnPreInit(EventArgs e)at System.Web.UI.Page.PerformPreInit()at System.Web.UI.Page .ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint) 目标站点:布尔的HandleError(System.Exception的)来源:System.Web程序 错误堆栈Trace是:在System.Web.UI.Page.HandleError(例外五) 在系统。 Web.UI.Page.ProcessRequestMain(布尔型 includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint) 在System.Web.UI.Page.ProcessRequest(布尔 includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint) 在System.Web.UI.Page.ProcessRequest()在 System.Web.UI.Page.ProcessRequest( HttpContext上下文) ASP.events_registration_aspx.ProcessRequest(HttpContext上下文) c:\ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 \ Temporary ASP.NET Files \ testWeb \ 761ce6e4 \ d915dd85 \ App_Web_posk8hm6.6.cs:第0行 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean & completedSynchronously)
我已经得到了上述错误的电子邮件时,该网站在IIS托管,但我DONOT得到它,当我在本地甚至online.The错误校验码说testfile的列亘古不属于即使查询返回列也是可数据的。
任何人都可以帮助可能是什么原因..
//////////////////////这是我的代码////// /////////////////////////0
public partial class Registration_Registration : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
FillImage();
}
protected void FillImage()
{
string Query = "select t.header_image_file as 'HeaderImage',t.image,c.testfile from registrars c left join trade t on c.tradeid = t.tradeid and c.mainitemid = t.mainitemid ";
DataTable result = GetDataTable(Query);
if (result != null && result .Rows.Count > 0)
{
if (result .Rows[0]["testfile"] != null)
{
this.Theme = result .Rows[0]["testfile"].ToString().Trim();
this.MasterPageFile = result .Rows[0]["testfile"].ToString().ToLower().Trim() + ".master";
}
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
}}
柱发生了什么,你特林在你的代码做列在您的查询? Registration.aspx.cs:第49行只是检查一个请更新您的答案 –
我是downvote:您从系统中复制/粘贴错误消息,甚至不读取它:“列'testfile'不属于表” - >您没有在您的生产数据库中创建您的专栏!并在标题中更加明确。 –
remi bourgarel希望你喜欢我的新标题。 –