I am very new to C#,so i was going through some projects online.I wasnt able to run this project
I am getting the following error when I click on the login button:
There is no row at position 0
Specifically from the Image3.ImageUrl = HDT.Rows[0]["image"].ToString(); line.
DS_HOUSE.HOUSE_SELECTDataTable HDT = new DS_HOUSE.HOUSE_SELECTDataTable();
DS_HOUSETableAdapters.HOUSE_SELECTTableAdapter HAdapter = new
DS_HOUSETableAdapters.HOUSE_SELECTTableAdapter();
protected void Page_Load(object sender, EventArgs e)
{
UDT = UAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
HDT = HAdapter.Select_By_SNAME_BLOCKNO(UDT.Rows[0]["societyname"].ToString(), Convert.ToInt32(UDT.Rows[0]["Houseid"].ToString()));
Image3.ImageUrl = HDT.Rows[0]["image"].ToString();
lblsname.Text = HDT.Rows[0]["sname"].ToString();
lblbno.Text = HDT.Rows[0]["blockno"].ToString();
lbltype.Text = HDT.Rows[0]["type"].ToString();
ViewState["HID"] = HDT.Rows[0]["HID"].ToString();
}
I am attaching the full project source code and database backup file .Please try running on your system as i dont have detailed knowledge about the project, being a beginner
[
Project Source Code with Database Backup File is attached here]
What I have tried:
I tried putting the code within if block with
protected void Page_Load(object sender, EventArgs e)
{
lblsell.Text = "";
UDT = UAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
HDT = HAdapter.Select_By_SNAME_BLOCKNO(UDT.Rows[0]["societyname"].ToString(), Convert.ToInt32(UDT.Rows[0]["Houseid"].ToString()));
if (HDT.Rows.Count > 0)
{
Image3.ImageUrl = HDT.Rows[0]["image"].ToString();
lblsname.Text = HDT.Rows[0]["sname"].ToString();
lblbno.Text = HDT.Rows[0]["blockno"].ToString();
lbltype.Text = HDT.Rows[0]["type"].ToString();
ViewState["HID"] = HDT.Rows[0]["HID"].ToString();
}
}
I was able to login however i was unable to retrieve details from the Society table.