Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foreach,后面的内容没有被拼接上; #2

Open
tryinggo opened this issue Sep 23, 2020 · 2 comments
Open

foreach,后面的内容没有被拼接上; #2

tryinggo opened this issue Sep 23, 2020 · 2 comments

Comments

@tryinggo
Copy link

image

@tryinggo
Copy link
Author

xml:

IF NOT EXISTS ( SELECT Id from [istrong_data_collection].[dbo].[FY_XjWeather] where StartTime = #{StartTime} ) BEGIN
        IF NOT EXISTS
        (SELECT Id from [istrong_data_collection].[dbo].[FY_XjWeather] where CompanyId = #{SiteCodeList['CompanyId']} and SiteCode = #{SiteCodeList['SiteCode']} and DataTime=#{SiteCodeList['Time']})
        BEGIN
        INSERT INTO [istrong_data_collection].[dbo].[FY_XjWeather]
        ([CompanyId],[SiteCode],[SiteSource],[Rain],[DataTime],[Remark])
        VALUES
        ($f{SiteCodeList['CompanyId']},$f{SiteCodeList['SiteCode']},#{SiteCodeList['SiteSource']},${SiteCodeList['Rain']},$f{SiteCodeList['Time']},#{SiteCodeList['DataSource']})
        END
        </foreach>
    END
</insert>
输出: IF NOT EXISTS ( SELECT Id from [istrong_data_collection].[dbo].[FY_XjWeather] where StartTime = '2020-08-03 13:00:00' ) BEGIN
    IF NOT EXISTS
    (SELECT Id from [istrong_data_collection].[dbo].[FY_XjWeather] where CompanyId = '64' and SiteCode = '58752' and DataTime='2020-08-03 13:00:00')
    BEGIN
    INSERT INTO [istrong_data_collection].[dbo].[FY_XjWeather]
    ([CompanyId],[SiteCode],[SiteSource],[Rain],[DataTime],[Remark])
    VALUES
    ('64','58752','2',1.688,'2020-08-03 13:00:00','测试')
    END

问题:
foreach后的END没有拼接上,请教大神,这个是为什么?

@dushitaoyuan
Copy link
Owner

完整的xml 发一下,你这个语法不太像sql啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants