Click here to Skip to main content
11,410,118 members (63,857 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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
        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 8-Feb-13 9:03am
Edited 8-Feb-13 9:08am
v2

1 solution

Rate this: bad
good
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='" & 
  Permalink  
v2
Comments
Navas Khanj at 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 at 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
0 Sergey Alexandrovich Kryukov 159
1 Maciej Los 68
2 Philippe Mori 60
3 BillWoodruff 60
4 OriginalGriff 60
0 Sergey Alexandrovich Kryukov 8,755
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web04 | 2.8.150414.5 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2015
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