Click here to Skip to main content
12,889,437 members (49,098 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
Dim strSQL27 As String = "SELECT STUFF((SELECT DISTINCT ',['+ FeesType +']' FROM FeeMaster WHERE Class='" & cboClass.Text & "' For XMl Path('')), 1, 1, '')"
        Dim DaAp27 As New SqlDataAdapter(strSQL27, con)
        Dim Dset27 As New DataTable
        DaAp27.Fill(Dset27)
 

 

 

strSQL11 = "SELECT * FROM (SELECT Regno, ST_Name, Class, Section, [FeeType], [Amount_Paid]  FROM Fees_Transaction) stdAdmission" & _
            " PIVOT (Sum(Amount_Paid) for FeeType in (" + Dset27.Rows(0).Item("Column1") + "))as PVTFT where Class='" & cboClass.Text & "'"
 

        Dim DaAp11 As New SqlDataAdapter(strSQL11, con)
        Dim DSet11 As New DataTable
        DaAp11.Fill(DSet11)
        DGV1.DataSource = DSet11
 
        ' How  can i Get Amount PAid Particular Column 
 
        For Each dr As DataRow In DSet11.Rows
            Me.DataGridView2.Rows.Add()
            With Me.DataGridView2.Rows(Me.DataGridView2.Rows.Count - 1)
                
                For i As Integer = 4 To DataGridView2.ColumnCount - 1
  .Cells(i).Value = dr("Amount_Paid")                Next
 
            End With
        Next

Here Show This ERROR How Can i Slove this...
Column 'Amount_Paid' does not belong to table .
Posted 15-Feb-13 6:48am
Updated 15-Feb-13 6:50am
v2

1 solution

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

Solution 1

debug your application by iterating through DataTable.Columns[^] property and check for DataColumn.ColumnName[^] property how it holds this column name and add your text based on that.
  Permalink  

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


Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 15 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