Click here to Skip to main content
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 8:03am
Edited 8-Feb-13 8: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 Dnyaneshwar@Pune 1,300
1 Sergey Alexandrovich Kryukov 667
2 Tadit Dash 350
3 ravikhoda 300
4 Manas Bhardwaj 240
0 Sergey Alexandrovich Kryukov 11,224
1 OriginalGriff 6,897
2 Peter Leow 4,795
3 Abhinav S 3,838
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web01 | 2.8.140421.2 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid