gpt4 book ai didi

vb.net - 在 VB.net 中多行具有多个条件的“If”语句

转载 作者:行者123 更新时间:2023-12-02 17:14:45 25 4
gpt4 key购买 nike

我正在检查两个文件是否存在,然后设置一个条件,但是当我添加 AND 时我收到一条错误消息,指出语法不正确

If (System.IO.Directory.GetFiles(CStr(Dts.Variables("VNetworkFolderName").Value), "Z_Attendance.xls").Length > 0
and System.IO.Directory.GetFiles(CStr(Dts.Variables("VNetworkFolderName").Value), "Z_EP.xls").Length > 0) Then
Dts.Variables("VCountAPAListFile").Value = True
Else
Dts.Variables("VCountAPAListFile").Value = False
End If

但是如果我只检查一个文件而不使用 AND 语句,它工作正常。

最佳答案

在行终止之前添加下划线 _ 以表示换行。

If (System.IO.Directory.GetFiles(CStr(Dts.Variables("VNetworkFolderName").Value), "Z_Attendance.xls").Length > 0 _
And System.IO.Directory.GetFiles(CStr(Dts.Variables("VNetworkFolderName").Value), "Z_EP.xls").Length > 0) Then
Dts.Variables("VCountAPAListFile").Value = True
Else
Dts.Variables("VCountAPAListFile").Value = False
End If

关于vb.net - 在 VB.net 中多行具有多个条件的“If”语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47078098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com