Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi All Please Help Me...
I have 3 Table View to DataGridView
 

This Table Data Want Display
 
Table1 (StudentDetails)			
Regno	Name	Class	Section
A100	Raja	I	A
A200	Ravi	I	A
 
This Table Filed Want Display To DataGridView Column
 
Table2(Fees Structure)
Class	FeeType	Total Amount	
I	Jan	1500	
I	Feb	2500	
I	Mar	1500	
I	Apr	3000	
I	Other	500
 

This Talbe Data Show to DGV
Table3 ( FeesTrans)
Regno 	Sname	Class	FeeType	Amount
A100	Raja	I	Jan	1000
A100	Raja	I	Jan	500
A100	Raja	I	Feb	2500
A100	Raja	I	Other	500
A200	Ravi	I	Jan	1500
A200	Ravi	I	Other	500
 
I want DataGridView Like This


Regno	Sname	Class	Section	Jan	Feb	Mar	Apr	Other	Total
A100	Raja	I	A	1500	500	0	0	500	2500
A200	Ravi	I	A	1500	0	0	0	500	200
Posted 17-Jan-13 8:17am
Edited 18-Jan-13 1:16am
v4
Comments
richcb at 17-Jan-13 15:36pm
   
This is not a question. Use the "Improve Question" widget to elaborate on what you are tring to achieve and provide the code you have attempted in order to accomplish that goal.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try this. just modify the query and join the needed tables.
SELECT Regno, Sname, Class, Section,
SUM(CASE WHEN FeeType = 'Jan' THEN Amount ELSE 0 END) AS Jan,
SUM(CASE WHEN FeeType = 'Feb' THEN Amount ELSE 0 END) AS Feb,
SUM(CASE WHEN FeeType = 'Mar' THEN Amount ELSE 0 END) AS Mar,
SUM(CASE WHEN FeeType = 'Apr' THEN Amount ELSE 0 END) AS Apr,
SUM(CASE WHEN FeeType = 'Other' THEN Amount ELSE 0 END) AS Other,
SUM(FeeType) AS 'Total'
FROM <TableName>
GROUP BY Regno
  Permalink  
Comments
Navas Khanj at 18-Jan-13 6:06am
   
Hi Tanks for Yor Replay.. But Wht i want.. Table 1 and Table 3 data Show to DataGirdView.. and Table 2 Data Show to DataGridView Column Header Text..
 
Please Tell Me

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

  Print Answers RSS
0 OriginalGriff 200
1 PIEBALDconsult 150
2 BillWoodruff 148
3 Jochen Arndt 135
4 DamithSL 130
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100