Dim dt As DataRow = Tables("会议纪要").Current.DataRow
Dim pth As String = ProjectPath & "Attachments\用户工程\" & dt("项目编号") & dt("工程名称") & "\" & dt("会议名称") & "\"
If Tables("会议纪要").Current Is Nothing Then
Return
End If
Dim dr As DataRow = Tables("会议纪要").Current.DataRow
If dr.RowState = DataRowState.Added Then '如果是新增行,必须先保存才能插入文件
dr.Save()
End If
Dim dlg As New OpenFileDialog
dlg.Filter = "图形文件|*.bmp;*.jpg;*.gif;*.png"
dlg.InitialDirectory = pth
dlg.MultiSelect = True
If dlg.ShowDialog =DialogResult.OK Then
For Each fl As String In dlg.FileNames
Dim ex As String = fl.SubString(fl.LastIndexOf(".") + 1) '获取文件后缀名
ex = ex & "|" & CRCCheckFile(fl) '将后缀名和文件的crc校验值组合成一个字符串
dr.SQLInsertFile("附件",fl) '插入文件
dr.SQLSetValue("CRC",ex) '将文件的后缀名和crc校验值保存在信息列
next
End If