【解決方法】ウェブサイトにアクセスできません


以下の問題について助けてください。ウェブサイト (alnadwacentre.com) が読み込まれていません…godaddy techsupport に確認したところ、コードの問題であるため開発者に連絡すると言われました…弊社の開発者はそうではありませんもう私たちのセンターとは関係がありません…そこで、ここで助けを得ることを考えました。

以下は Web サイトからの出力です。

Server Error in '/' Application.
There is no row at position 0.
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.IndexOutOfRangeException: There is no row at position 0.

Source Error:


Line 46:         DataSet ds = new DataSet();
Line 47:         ds = ObjAdd.DisplayPrayerTime();
Line 48:         lblPrayerTime.Text = ds.Tables[0].Rows[0][0].ToString();
Line 49:     }
Line 50:    

Source File: g:\pleskvhosts\alnadwacentre.com\httpdocs\Index.aspx.cs    Line: 48

Stack Trace:


[IndexOutOfRangeException: There is no row at position 0.]
   System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +2519522
   System.Data.DataRowCollection.get_Item(Int32 index) +20
   Home.DisplayPrayerTimeTable() in g:\pleskvhosts\alnadwacentre.com\httpdocs\Index.aspx.cs:48
   Home.Page_Load(Object sender, EventArgs e) in g:\pleskvhosts\alnadwacentre.com\httpdocs\Index.aspx.cs:19
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533

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

————————
私たちの インデックス.aspx.cs ファイル:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;

public partial class Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DisplayLink();
            DisplayNews();
            DisplayPrayerTimeTable();
        }
    }
    public void DisplayLink()
    {
        string link = string.Empty;
        ImperoIT.ManagePrayerTime ObjAdd = new ImperoIT.ManagePrayerTime();
        DataSet ds = new DataSet();
        ds = ObjAdd.DisplayLink();
        GV_Link.DataSource = ds;
        GV_Link.DataBind();
    }
    public void DisplayNews()
    {
        string News = string.Empty;
        ImperoIT.ManagePrayerTime ObjAdd = new ImperoIT.ManagePrayerTime();
        DataSet ds = new DataSet();
        ds = ObjAdd.DisplayNewsTitel();
        NewsRepeater.DataSource = ds;
        NewsRepeater.DataBind();
        ObjAdd = null;
        ds.Dispose();
    }
    public void DisplayPrayerTimeTable()
    {
        string News = string.Empty;
        ImperoIT.ManagePrayerTime ObjAdd = new ImperoIT.ManagePrayerTime();
        DataSet ds = new DataSet();
        ds = ObjAdd.DisplayPrayerTime();
        lblPrayerTime.Text = ds.Tables[0].Rows[0][0].ToString();
    }   
}

私が試したこと:

私には開発者のスキルがないため、あまりチェックできません…あなたの助けに非常に感謝しています。

解決策 1

コードでは次の行を想定しています。

C#
ds = ObjAdd.DisplayPrayerTime();

大量の行を返しています。 DisplayPrayerTime によってテーブルまたは行が返されたかどうかはチェックされません。

行が返されないのはなぜですか? DisplayPrayerTime のコードも、データベースが存在すると仮定して、そのコードがデータベースに対して実行しているクエリも示していないため、誰も教えてくれません。

コメント

タイトルとURLをコピーしました