Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 45:         string sql = " " + DieuKien + " ";
Line 46:         if (Loai == "1")
Line 47:             sql += (alias == "" ? "" : alias + ".") + "idGianHang in (" + t.idGianHang + "," + t.tbGianHang.Rows[0]["idGianHangQuanLy"].ToString() + ")";
Line 48:         else if (Loai == "3")
Line 49:             sql += (alias == "" ? "" : alias + ".") + "idGianHangQuanLy = " + t.tbGianHang.Rows[0]["idGianHangQuanLy"].ToString() + "";

Source File: c:\inetpub\wwwroot\PMYumo\App_Code\MyStaticData.cs    Line: 47

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   MyStaticData.SQL_DieuKienGianHang(ThongTin t, String alias, String Loai, String DieuKien) in c:\inetpub\wwwroot\PMYumo\App_Code\MyStaticData.cs:47
   MyStaticData.sqlLaySanPhamGianHang(ThongTin t, ModelSanPham sp, String HienThi, Boolean isSPTonKho, Boolean isTenSP) in c:\inetpub\wwwroot\PMYumo\App_Code\MyStaticData.cs:1942
   SanPham_DanhSachSanPham.SQLSanPham(Boolean KTSP) in c:\inetpub\wwwroot\PMYumo\Views\SanPham\DanhSachSanPham.aspx.cs:354
   SanPham_DanhSachSanPham.LoadSanPham() in c:\inetpub\wwwroot\PMYumo\Views\SanPham\DanhSachSanPham.aspx.cs:432
   SanPham_DanhSachSanPham.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\PMYumo\Views\SanPham\DanhSachSanPham.aspx.cs:201
   System.Web.UI.Control.OnLoad(EventArgs e) +102
   System.Web.UI.Control.LoadRecursive() +67
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1380


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2623.0