I have Two Sql Table.
1st Table name is Allowence and Columns are EmpId,Name,Basic Salary,Da,Ca,HRA.
2nd Table name is Deduction and columns are EmpId, PF,ESI,Others.

I wants to display all these column to a DataGridView.
also I want to calculate Gross Salary and display this Gross Salary value to DataGridView.

I am using Visulal Studio 2010 and sql server 2008.
Please help to solve these problem.

Recommended Answers

All 3 Replies

Can you show us what you've managed to do so far please?

If you're having trouble getting the information out of your tables then the best thing to do is to retrieve all information using the same SQL querey.

How are the two tables linked?.

To expand on Chris's post, to retrieve all the information at once, you will need to do an inner join on the two tables, using EmpId as your matching criteria.

As you haven't posted any of your work, it's difficult to help you any further.

use the join query to retrive the data from mltiple tables Like a simplest example:
select Allowence.*, Deduction.PF, Deduction.ESI, Deduction.Others from Allowence, Deduction where Allowence.EmpId = Deduction.EmpId

you can also use 'AS' to add a new column and insert the calculated Gross Salary. try this and please let me know the status.

Please note: there always a one or more columns on tables like 'EmpId' that interconnect them to retrive data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.