Iam doing a project in Visual studio 2008, I connected database from MS SQL Server 2005 to Visual studio 2008. In my SQL I've created two tables, Student Information Table and the Payment Table. In my Student Information table I have the following fields: Student Number, Name, Year Level and Section... while in my Payment table I have Student Number, Downpayment, Balance fields... What I want to do is when I click a button 'SAVE' it will save in the database then whenever I want to view the Payment Records of Student it will display the Student Number, Name, Downpayment and Balance in combined in one table in a form... How can I do that? Can you provide me some codes? or any explanation about it? thanks.. :)
select a.StudentNumber, Name,DownPayment,Balance from StudentInformation a inner join Payment b on a.StudentNumber = b.StudentNumber
where StudentNumber = '1234'
But I am not sure that the structure you are following will work out for you.
What are you storing in downpayment? Only the last payment? How will you keep track of all the payments (if this is the table, you might want to also record payment date and payment method). Also Balance is not something we would record with payments, as it needs to be updated with the Credit as well as with the Debit.