以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  能不能帮我改一下这个代码。  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=144906)

--  作者:hongye
--  发布时间:2020/1/2 14:34:00
--  能不能帮我改一下这个代码。
我想将图片上传到ftp,并将路径填入SQL的款式图片当前行中(项目里没有表)

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 = "From {订单主表} where " & filters
    Dim dtsj As DataTable
    dtsj = cmd.ExecuteReader(True) \'记得将参数设置为True
    If ftp1.Upload(dlg.FileName, "/kst/"& dtsj("合同号")& dtsj("款号")& ".jpg") = True Then
        dtsj.("款式图片") &= IIF(dtsj.IsNull("款式图片"), "", vbcrlf) & "/kst/"& r("合同号")& r("款号")& ".jpg"
        Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Else
        Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
    ftp1.close
End If

--  作者:有点蓝
--  发布时间:2020/1/2 14:55:00
--  
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

--  作者:hongye
--  发布时间:2020/1/2 17:42:00
--  
dtsj.DataRows(0)("款式图片") &= IIF(dtsj.DataRows(0).IsNull("款式图片"), "", vbcrlf) & "/kst/" & e.Form.Controls("合同号").Text & e.Form.Controls("款号").Text & ".jpg"

这个代码好像没有用啊,数据没有填进去

--  作者:hongye
--  发布时间:2020/1/2 18:34:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:问题.txt


帮我看看代码,怎么还是错误,闪退弹出

[此贴子已经被作者于2020/1/2 18:40:11编辑过]

--  作者:hongye
--  发布时间:2020/1/2 19:44:00
--  
问题解决了