Click here to Skip to main content
12,957,526 members (58,741 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
This CODE USE FOR DGV COLUMN HEADER TEXT
 Dim strSQL11						
					
        strSQL11 = "SELECT STUFF((SELECT DISTINCT ',['+ FeesType +']' FROM FeeMaster WHERE Class='" & cboClass.Text & "' For XMl Path('')), 1, 1, '')"					
Dim DaAp11 As New SqlDataAdapter(strSQL11, con)					
Dim Dset11 As New DataTable						
        DaAp11.Fill(Dset11)						
						
						
						
 Dim strSQL12						
        strSQL12 = "SELECT * FROM (SELECT stdAdmission.Regno, stdAdmission.Sname, stdAdmission.Class, stdAdmission.Section , Fees_Transaction.FeeType," & _						
         " Fees_Transaction.Amount_Paid, stdAdmission.Mobile1 FROM Fees_Transaction INNER JOIN stdAdmission ON Fees_Transaction.Regno=stdAdmission.Regno)as NTable" & _						
         " PIVOT (Sum(Amount_Paid) for FeeType in (" + Dset11.Rows(0).Item("Column1") + ")) as PVT where Class='" & cboClass.Text & "'"						
						
        Dim DaAp12 As New SqlDataAdapter(strSQL12, con)						
        Dim Dset12 As New DataTable						
        DaAp12.Fill(Dset12)						
        DGV1.DataSource = Dset12	

Above CODE Display DGV LIKE THIS

Regno Name Class Section Jan Feb Mar
A100 AAA I A 50 100 650
A200 BBB I A 650 500 200
A300 CCC I A 200 250 750


strSQL10 = "SELECT * FROM (SELECT stdAdmission.Regno, stdAdmission.Sname, stdAdmission.Class, stdAdmission.Section , FeesMaster.FeeType," & _						
         " FeesMaster.FeeAmount, stdAdmission.Mobile1 FROM FeesMaster INNER JOIN stdAdmission ON FeesMaster.Regno=stdAdmission.Regno)as NTable" & _						
         " PIVOT (Sum(FeeAmount) for FeeType in (" + Dset11.Rows(0).Item("Column1") + ")) as PVT where Class='" & cboClass.Text & "'"						
						
        Dim DaAp10 As New SqlDataAdapter(strSQL10, con)						
        Dim Dset10 As New DataTable						
        DaAp10.Fill(Dset10						
DGV2.DataSource = Dset12
 


Regno Name Class Section Jan Feb Mar
A100 AAA I A 650 500 750
A200 BBB I A 650 500 750
A300 CCC I A 650 500 750


DGV3

I NEED DGV LIKE THIS HOW CAN I DO THIS

Regno Name Class Section Jan Feb Mar
A100 AAA I A 600 400 100
A200 BBB I A 0 0 550
A300 CCC I A 450 250 0
Please Tell me How Can i SUBTRcAT (FeeAmount - AmountPaid )
Posted 21-Feb-13 7:23am
Updated 21-Feb-13 7:38am
v3

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,994
CHill60 3,550
Maciej Los 3,312
ppolymorphe 2,170
Jochen Arndt 1,973


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
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