Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i want to show defaulter students(who have not paid fees of this month) in list view. I have two tables in database one contains student record and other contains their fee record. Can you please tell me how to write query to solve my problem.. any help would be appreciated.
Posted
Comments
[no name] 3-Mar-13 11:59am    
What database? What is the schema? What have you tried? If you did not know anything about your project and you read this, could you answer the question? You did not even tell us what problem it is that you have? Can you write a query? Do you know SQL? Can you connect to a database? [Edit] What have you done to accomplish your homework yourself instead of reposting this? [/Edit]

1 solution

Make this function with Ado.net code


C#
public DataTable selectstudent() 
        {
            com.Connection = con;
             con.Open();
            com.CommandText = "select StudentId,StudentName,StudentFees from Student inner join  Fees on student.StudentId=fees.StudentId Where StudentFees=0";

            com.CommandType=CommandType.Text;
            SqlDataReader sdr= com.ExecuteReader();
            DataTable dt=new DataTable();
            dt.Load(sdr);
            con.Close();
            return dt;

        }


Then..

in The Load Form

make An object With The Class Which Contain The Function
And..


C#
DataTable Dt=ClassObject.selectstudent();
ListView.DataSource=Dt;
 
Share this answer
 
v2
Comments
Zoltán Zörgő 3-Mar-13 12:19pm    
The concept itself might be good, but you have not taken into account the very essence of the question: who have not paid fees of this month. You select all students with all payed fees. That's a difference...
Mostafa Metwally 3-Mar-13 12:36pm    
yes yes you are right

i edited This Now

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900