到红字处出错,这是为什么?
Dim filters As String = "合同号 = '" & e.Form.Controls("合同号").Text & "'And 款号 = '" & e.Form.Controls("款号").Text & "' And 业务担当 = '" & e.Form.Controls("业务担当").Text & "' And 合同交期 = '" & e.Form.Controls("合同交期").Text & "' And 客户名称 = '" & e.Form.Controls("客户名称").Text & "' And 品名 = '" & e.Form.Controls("品名").Text & "'"
Dim cmd As New SQLCommand
Dim dtsj As DataTable
cmd.C
cmd.CommandText = "select * Fro m {订单主表} where " & filters
dtsj = cmd.ExecuteReader(True) '记得将参数设置为True
If dtsj.DataRows.count = 0 Then
msgbox("没有数据")
Return
End If
Dim pbxk As WinForm.PictureBox = Forms("订单查询修改").Controls("PictureBox1")
Dim img As String = ProjectPath & "Attachments\暂无图片.jpg"
Dim sfz As String = dtsj.DataRows(0)("款式图片")
Dim fmz As String = ProjectPath & "\RemoteFiles\" & sfz
Dim nr As WinForm.TextBox = e.Form.Controls("合同号")
Dim nk As WinForm.TextBox = e.Form.Controls("款号")
Dim ftp1 As New FtpClient
ftp1.Host=Tables("FTPIP").Current("FTPhost")
ftp1.Account = Tables("FTPIP").Current("FTPAccount")
ftp1.Password = Tables("FTPIP").Current("FTPpassword")
If ftp1.FileExists(sfz) Then
ftp1.DeleteFile(sfz)
sfz = Nothing
dtsj.Save()
End If
If FileSys.FileExists(fmz) Then
FileSys.DeleteFile(fmz,2,2)
End If
Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
If ftp1.Upload(dlg.FileName, "\kst\"& e.Form.Controls("合同号").Text & e.Form.Controls("款号").Text & ".jpg") = True Then
dtsj.DataRows(0)("款式图片") &= IIF(dtsj.DataRows(0).IsNull("款式图片"), "",vbcrlf) & "\kst\" & e.Form.Controls("合同号").Text & e.Form.Controls("款号").Text & ".jpg"
Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
msgbox(1)
dtsj.Save()
msgbox(2)
If FileSys.FileExists(fmz) = False AndAlso ftp1.FileExists(sfz) Then
msgbox(2.5)
ftp1.Download(sfz,fmz)
msgbox(3)
End If
If FileSys.FileExists(fmz) Then
pbxk.ImageFile = fmz
msgbox(4)
Else
pbxk.ImageFile = img
msgbox(5)
End If
ftp1.close
msgbox(6)
End If
If dtsj.HasChanges Then
msgbox(7)
If MessageBox.Show("订单已经被修改,是否保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
dtsj.Save()
End If
End If