2
Reply

How can fetch/differentiate experienced from same table....

Abhimanyu Singh

Abhimanyu Singh

May 27 2013 1:54 AM
1.2k
Hello All,
As i am new in this field so i need some help from you all..Please!!
Actually i am working on one old project that have 3-registration page as it has older flow of itself but now i have to differentiate it i mean have to fetch the separate model list as per their experianced/fresher...on radiobutton selected event of searching page so that models can see easly their profile...problem is that if i am creating seperate table for both it will be complex and will take more pages...So i created one more column "experienced" and inserted the radiobutton selected value in it.

Now insertion is ok but i need to display it on basis of their categories...on radiobutton selection(Searching option: 1) Fresher  & 2) Experienced ).

.CS code of 3rd registration page is:
con.Open();
SqlCommand cmd = new SqlCommand("update Models set Experience_details = '" +RadioButtonList1.SelectedItem.Text + "', profile_image = '" + Label4.Text + "' where Model_name = '" + Session["selected"].ToString() + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
con.Close();
 


.CS code For Searching:(This is older one but i want as i mentioned in query)

   protected void Page_Load(object sender, EventArgs e)
  {
  if (Session["to"] != null)
  {
  if (!IsPostBack)
  {
  con.Open();
  SqlDataAdapter da1 = new SqlDataAdapter("select * from Models where (Gender='" + Session["gender"].ToString() + "' and approval='Accept') and Age between '" + Session["to"].ToString() + "'  AND '" + Session["from"].ToString() + "' ", con);
  DataSet ds1 = new DataSet();
  da1.Fill(ds1);
  DataTable dt1 = ds1.Tables[0];
  DataList2.DataSource = dt1;
  DataList2.DataBind();
  con.Close();
  }
  }
 
  else
  {
  if (!IsPostBack)
  {
  con.Open();
  SqlDataAdapter da1 = new SqlDataAdapter("select * from Models where approval = 'Accept'", con);
  DataSet ds1 = new DataSet();
  da1.Fill(ds1);
  DataTable dt1 = ds1.Tables[0];
  DataList2.DataSource = dt1;
  DataList2.DataBind();
  con.Close(); 
   }
  } 
  }



Any body can help me to fetch it as per their categories

Answers (2)