SqlCommand cmd = new SqlCommand("select email ,phone,fname,lname, CurrentLocation , Gender , DateOfBirth , landline,address,category , qualification , EducationSpecialization , InstituteName , coursetype , TotalExperience , CurrentSalary , jobtitle , companyname , IndustryofComapny , FunctionAreaOfJob , DesiredLocation , DesiredSalary , DesiredIndustry,name from UserInfo where userid=@userid", cn);
cmd.Parameters.Add(new SqlParameter("@userid", Session["userid"]));
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (dr[20] != DBNull.Value)
{
ddldesiredlocation.SelectedItem.Text = dr.GetString(20).ToString();
}
else
{
ddldesiredlocation.SelectedItem.Text = "";
}
if (dr[21] != DBNull.Value)
{
ddldesiredsal.SelectedItem.Text = dr.GetString(21).ToString();
}
else
{
ddldesiredsal.SelectedItem.Text = "";
}
if (dr[22] != DBNull.Value)
{
ddldesiredindustry.SelectedItem.Text = dr.GetString(22).ToString();
}
else
{
ddldesiredindustry.SelectedItem.Text = "";
}
SqlCommand cmd1 = new SqlCommand(" select name from UserInfo where userid=@userid", cn);{ here i am getting a error please close the datareader.how to resolve this error.plz help . i want that is resume is there gridview is shown otherwise not.
cmd1.Parameters.Add(new SqlParameter("@userid", Session["userid"]));
SqlDataAdapter da = new SqlDataAdapter(cmd1);
if (dr[0] != DBNull.Value)
{
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}