binding the data

Apr 21 2009 5:06 AM

hi,

The below is the code to bind the year and quarter in the form.  it is working now.

protected void Page_Load(object sender, EventArgs e)

{

lblError.Text = "";

username = Context.User.Identity.Name.Replace("SASKEN\\", "");

try

{

if (!IsPostBack)

{

btnSubmit.Enabled = false;

string Closed_Date = "";

SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnString"].ToString());

SqlCommand cmd = new SqlCommand("HRN_SP_CheckDateClosed", conn);

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@HRN_Clsdate", Closed_Date);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

da.Fill(ds);

conn.Open();

SqlDataReader DR_ClsDate = cmd.ExecuteReader(CommandBehavior.CloseConnection);

if (DR_ClsDate != null)

{

if (DR_ClsDate.Read())

{

Closed_Date = DR_ClsDate[0].ToString();

pnlAOQ.Visible = true;

lblYear.Text = Session["HRN_Year"].ToString();

lblQtr.Text = Session["HRN_Qtr"].ToString();

}

else

{

pnlAOQ.Visible = false;

lblError.Text = "Award period is closed.";

}

}

}

}

catch (Exception ex)

{

lblError.Text = ex.Message;

lblError.Visible = true;

}

finally

{

conn.Close();

}

}

 

can anybody help on this?

 

Rgds,

Geetha


Answers (5)