以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]完善BeforeAttachFile代码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=188902)

--  作者:老鼠
--  发布时间:2023/10/29 16:52:00
--  [求助]完善BeforeAttachFile代码
以下是现有代码,如何完善才能使其在同一行录入多张图片时,名称不会重复。
Dim dr As DataRow = e.DataRow
If dr.IsNull("姓名") Or Dr.IsNull("身份证号码") Or Dr.IsNull("证照资料取得日期") Then
    MessageBox.Show("请先输入姓名与身份证号码还有证照资料取得日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
    e.Cancel = True
Else
    e.SubFolder = e.DataRow("证照资料名称")
    e.FileName = dr("姓名") & "(" & dr("身份证号码") & ")_" & dr("证照资料取得日期") & ".jpg"
End If

--  作者:有点蓝
--  发布时间:2023/10/29 20:08:00
--  

Dim dr As DataRow = e.DataRow
dim file as string =  dr("姓名") & "(" & dr("身份证号码") & ")_" & dr("证照资料取得日期") & ".jpg"
if dr.lines("某附件列").contains(file) then
e.Cancel = True
msgbox("重复了")
return
end if
If dr.IsNull("姓名") Or Dr.IsNull("身份证号码") Or Dr.IsNull("证照资料取得日期") Then
……