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 7:23am
Edited 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
0 OriginalGriff 278
1 Maciej Los 205
2 DamithSL 193
3 Nguyen.H.H.Dang 190
4 arvind mepani 187


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