PIVOT TABLE ERROR'+ VF'附近的语法不正确。 [英] PIVOT TABLE ERROR Incorrect syntax near ' + VF '.

查看:81
本文介绍了PIVOT TABLE ERROR'+ VF'附近的语法不正确。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请告诉我如何解决此错误



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







此代码错误是('+ VF附近的语法不正确''。)如何解决这个请告诉我U建议..




This Code Error is (Incorrect syntax near '' + VF ''.) How to slove this please tell me U Advice..

推荐答案

更改它指定的行:

Change the line it is specifying to this:
" PIVOT (Sum(Amount_Paid) for FeeType in ( ''" & VF & "'' ))as PVT where Class=''" &


这篇关于PIVOT TABLE ERROR'+ VF'附近的语法不正确。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆