Esempio n. 1
0
        private void Show_data()
        {
            con.Open();
            SqlCommand     cmd = new SqlCommand("select a.RegistrationNo,s.Name,s.Branch,s.Batch,h.Hostel_Name,r.RoomNO from Allocation a,Student_Details s,Hostel h,Rooms r where a.RegistrationNo = s.RegistrationNo and  a.Hostel_Id=h.Hostel_ID and a.RoomID=r.RoomId and a.Status='active'", con);
            DataSet        ds  = new DataSet();
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            da.Fill(ds);
            GridViewDetailsForDeallocation.DataSource = ds;
            GridViewDetailsForDeallocation.DataBind();
            con.Close();
        }
Esempio n. 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlCommand comd = new SqlCommand("select count(*) from Allocation where  RegistrationNo ='" + TextBoxRegno.Text + "' and Status='Active'", con);

            con.Open();
            int StudtExist = (int)comd.ExecuteScalar();

            if (StudtExist > 0)
            {
                SqlCommand     cmd = new SqlCommand("select a.RegistrationNo,s.Name,s.Branch,s.Batch,h.Hostel_Name,r.RoomNO from Allocation a,Student_Details s,Hostel h,Rooms r where a.RegistrationNo = s.RegistrationNo and  a.Hostel_Id=h.Hostel_ID and a.RoomID=r.RoomId and a.Status='active' and a.RegistrationNo ='" + TextBoxRegno.Text + "'", con);
                DataSet        ds  = new DataSet();
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(ds);
                GridViewDetailsForDeallocation.DataSource = ds;
                GridViewDetailsForDeallocation.DataBind();
                con.Close();
            }
            else
            {
                LabelWrite1.Text = "*Student Details Not Found Check If Registration Number is Correct";
            }
        }