请高手帮我找下这段asp.net代码报错原因
追问:“/”应用程序中的服务器错误。 未将对象引用设置到对象的实例。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
行 45: 行 46: string sql =string.Format( "SELECT count(*) FROM Employee where eLoginId='{0}' and eLoginPwd='{1}'",loginId,loginPwd); 行 47: SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["dbString"].ToString()); 行 48: SqlCommand command = new SqlCommand(sql, connection); 行 49: |
源文件: D:\我的文档\Visual Studio 2008\Projects\no.8\no.8\index.aspx.cs 行: 47
堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。] no._8._Default.btnLogin_Click(Object sender, EventArgs e) in D:\我的文档\Visual Studio 2008\Projects\no.8\no.8\index.aspx.cs:47 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 |
版本信息: Microsoft .NET Framework 版本:2.0.50727.3603; ASP.NET 版本:2.0.50727.3053