Create a view that contains the two table then u can check the fields u want to display. then bind the new view to a form .
Or query the db using a join. What are you building?
With some more info, we might be more helpful
Best is to use a 'JOIN' statement
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.. :)
Your query would be:
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.
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.