Hi,
I have an information system which records beach volleyball Players, Teams, Tournaments, Groups, Matches... When I
click on
select Tournament it redirects to new page - Detail of Tournament, where are shown registrations, groups A,B,C,... And also you can registrate to tour if it is not played Tournament.
Session ["Tournament"] is filled with tournament id before it redirects, but it still produce this error, does anyone know why??
Session ["Nickname"] represents logged user.
Error at:
if (Session["Nickname"] == null || DateTime.Now > client.Reader.GetDateTime(1))
throw: Invalid attempt to read when no data is present.
Code:
using Database.Client;
...
protected void Page_Load(object sender, EventArgs e)
{
Client client = new Client();
try
{
client.Connect();
client.Command = client.Connection.CreateCommand();
client.Command.CommandText = "select Name, Tournament_Begining from Tournament where ID = @id";
client.Command.Parameters.Add("@id", System.Data.SqlDbType.Int, 10, "ID").Value = Session["Tournament"];
client.Reader = client.Command.ExecuteReader();
while (client.Reader.Read())
{
lblTournamentName.Text = client.Reader.GetString(0);
}
if (Session["Nickname"] == null || DateTime.Now > client.Reader.GetDateTime(1))
{
Panel3.Visible = false;
}
else
{
Panel3.Visible = true;
lblRegister.Visible = false;
}
client.Disconnect();
}
catch (Exception)
{
throw;
}
Thank You for replies!
-Pepin z Hane