Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
Dim ftp1 As New FtpClient
ftp1.Host="binyang.66ip.net"
ftp1.Account = "byftpuser"
ftp1.Password = "654321"
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
cmd.CommandText = "select * From {订单主表} where " & filters
Dim dtsj As DataTable
dtsj = cmd.ExecuteReader(True) '记得将参数设置为True
if dtsj.datarows.count = 0 then
msgbox(“没有数据”)
return
end if
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
ftp1.close
End If