Click here to Skip to main content
12,763,515 members (32,455 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
Hi All

Please tell me How to Slove This Error

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

        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
        DGV1.DataSource = DSet1

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

1 solution

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

Solution 1

Change the line it is specifying to this:
 " PIVOT (Sum(Amount_Paid) for FeeType in ( '" & VF & "' ))as PVT where Class='" & 
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..
richcb 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

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 8 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