Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 8:23am
Edited 21-Feb-13 8:38am
v3

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 21 Feb 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