Split Dataset in 3

try
{
CommonGridBind(gvwCenteralVivaFirst,1);
CommonGridBind(gvwCenteralVivaSecond,2);
CommonGridBind(gvwCenteralVivaThird,3);
}
catch (Exception ex) { }

public void CommonGridBind(GridView Grid,Int32 _NTILE_PARAM)
{
String TermId = ddTermId.Text.Trim();
String TeacherId = Session["UserId"].ToString().Trim();
String Qs = "SELECT * FROM T_Term_TeacherInCharge WHERE TermId='" + TermId.Trim() + "' AND TeacherId='" + TeacherId + "'";
if (ClsCommon.GetAdhocResult(Qs).Tables[0].Rows.Count > 0)
{
String Query = " Select StudentId,CenteralViva from(select StudentId, CenteralViva, NTILE(3) OVER(ORDER BY StudentId ASC) AS Row from"+
" (SELECT DISTINCT T_Term_Student_Result_Lab_Details.StudentId, Ceiling(IsNull(T_Term_Student_Result_Lab_Details.CenteralViva,0)) AS CenteralViva"+
" FROM T_Term_Student_Result_Lab_Details INNER JOIN T_Term_Course_Offer ON T_Term_Student_Result_Lab_Details.CourseId = T_Term_Course_Offer.CourseId"+
" WHERE T_Term_Student_Result_Lab_Details.TermId='" + ddTermId.Text.Trim() + "'" +
" AND T_Term_Course_Offer.CourseType='Sessional')T)N where N.Row = '" + Convert.ToString(_NTILE_PARAM).Trim() + "'";
DataSet ds = new DataSet();
ds = ClsCommon.GetAdhocResult(Query);
DataTable dt = new DataTable();
dt = ds.Tables[0];
Grid.DataSource = dt;
Grid.DataBind();
}
else
{
lblErrorMessage.Text = "You are not the Teacher-In-Charge of this term..!";
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s