Showing posts with label student. Show all posts
Showing posts with label student. Show all posts

Wednesday, March 21, 2012

Hi Need Help

I have an application in c#. Which is intended to give student with highest marks in each class.

There are 10 classes

The requirement is to find top student of each class and display it in columnwise like below

Class Student Name

Can anyone help me on that.

Thanks in advance

Hi,

Prepare the SQL Query which returns the Top 10 values from each class vise..

Select Top 10 Stud-ID,Stud_Name from StudentTable where StudentClass = UserParameter;

Write the C# Method which accept the One Parameter from the User and return the result set.

public DataSet GetTopTen(string strClassParam)
{
ds = new DataSet();
if (ObjCon.State == ConnectionState.Open) ObjCon.Close();
ObjCon.Open();
string strQuery = "Select Top 10 Stud-ID,Stud_Name from StudentTable where StudentClass ="+strClassParam; (Change the Query according to your need..)
sc = new SqlCommand(strQuery, ObjCon);
sda = new SqlDataAdapter(sc);
sda.Fill(ds);
ObjCon.Close();
return ds;
}

Biind the Result Set to the DataGrid or Gridview to show it.

That is it.

|||

hi,

i assume that u r geeting yr data from sql qury. if so, then u can get ur data by firing such query

selectdistinct class,studentnamefrom studenttablewhere mark=(selectmax(mark)from studenttable)

you can getthis by declaring dataset.u can bind gridview withclass and studentname bounded columns and assigning datasource to it like

gridview1.datasource = ds.tables[0].defaultview;

gridview1.databind();

Monday, March 19, 2012

hi

Hi,
I have a StudentMark table (StudentID int , SubjectID int, Mark int,
Semester tinyint)
The pass criteria for each student is given as follow
1. He should pass in all the 6 subjects (pass mark = 40)
2. Condition 1 +
1. Avg of any 4 subjects is 40% + Avg any 3 70%
or
2. Avg of any 5 subjects is 50% + avg of any 2 is 80%
or
3. Avg of all the subjects is 60%
can i do it in a single Query ? I had done it using table vars?
Thanks in Advance
LaraBased on your narrative, it sounds like it can be handled in a single query.
But without details on table structures, sample data & expected results,
others can only guess ( for details see: www.aspfaq.com/5006 )
Anith