积极答复者
未将对象引用设置到对象的实例。

问题
-
“/”应用程序中的服务器错误。
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。] FreeTextBoxControls.Support.ResourceManager.LoadResource(Hashtable target, String language, String cacheKey) +496 FreeTextBoxControls.Support.ResourceManager.GetResources() +247 FreeTextBoxControls.Support.ResourceManager.GetString(String name) +39 FreeTextBoxControls.Support.Helper.PopulateDefaultDropDownList(ToolbarDropDownList toolbarDropDownList, FreeTextBox freeTextBox, ResourceManager resourceManager) +5927 FreeTextBoxControls.FreeTextBox.OnPreRender(EventArgs e) +681 System.Web.UI.Control.PreRenderRecursiveInternal() +80 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
代码
SqlConnection sqlconn = DBsql.strSql();
try{
sqlconn.Open();
SqlCommand sqlcmd = new SqlCommand("insert into news (Type,Title,Contents,Time) values ('"
+ this.NewsType.SelectedItem.Text + "','" + this.TextTitle.Text + "','" + this.FreeTextBox.Text + "','" + this.TextTime.Text + "')", sqlconn);
int rows=sqlcmd.ExecuteNonQuery();if (Page.IsValid)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alter('发表成功!')</script>");}
else
{
this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alter('发表失败!')</script>");}
}
catch (SqlException ex)
{
throw new ApplicationException(ex.Message);
}
finally
{
sqlconn.Close();
}- 已移动 Sheng Jiang 蒋晟Moderator 2010年8月13日 19:42 (发件人:ADO.NET 与 LINQ)
答案
全部回复
-
是FreeTextBoxControls.Support.ResourceManager.LoadResource这里的问题,把这个函数的代码贴出来
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP