Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi All

Please tell me How to Slove This Error

VB
Dim strSQL2 As String = "SELECT [FeesType] FROM FeeMaster WHERE Class='" & cboClass.Text & "'"
        Dim DaAp2 As New SqlDataAdapter(strSQL2, con)
        Dim Dset2 As New DataTable
        DaAp27.Fill(Dset2)
        Dim VF
        For i = 0 To Dset2.Rows.Count - 1
            VF = Dset2.Rows(i).Item("FeesType")
        Next

        Dim strSQL1 As String
        strSQL1 = "SELECT * FROM (SELECT SA.Regno, SA.Sname, SA.Class, SA.Section , FT.FeeType," & _
            " FT.Amount_Paid  FROM Fees_Transaction as FT INNER JOIN stdAdmission as SA ON FT.Regno=SA.Regno) FeeMaster" & _
            " PIVOT (Sum(Amount_Paid) for FeeType in ( ' + VF ' + ))as PVT where Class='" & cboClass.Text & "'"
        Dim DaAp1 As New SqlDataAdapter(strSQL1, con)
        Dim DSet1 As New DataTable
        DaAp1.Fill(DSet1)
        DGV1.DataSource = DSet1



This Code Error is (Incorrect syntax near ' + VF '.) How to slove this please tell me U Advice..
Posted
Updated 8-Feb-13 8:08am
v2

1 solution

Change the line it is specifying to this:
" PIVOT (Sum(Amount_Paid) for FeeType in ( '" & VF & "' ))as PVT where Class='" &
 
Share this answer
 
v2
Comments
Navas Khanj 8-Feb-13 14:49pm    
PIVOT (Sum(Amount_Paid) for FeeType in ( [" & VF & "] ))as PVT where Class='" &
it's working ..
One more Error is I have Two Data For Exampel (Team-1, Team-2). Now DGV Column Show One Column. Frist Team-1 Data Display again Same Column Show Team-2 Data.. how to make Team-1 and Team-2 Please Tell me u Advice..
Richard C Bishop 8-Feb-13 14:53pm    
If you have another error, accept this as your solution, and post the next error in a sepparate thread with all the same info you did in the first one please. I would be happy to look at that one as well.

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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900