Foxtable(狐表)用户栏目专家坐堂 → 二进制照片列存储过程中出现的问题,请指教


  共有2281人关注过本帖树形打印复制链接

主题:二进制照片列存储过程中出现的问题,请指教

帅哥哟,离线,有人找我吗?
黄训良
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1100 积分:8985 威望:0 精华:0 注册:2014/3/15 14:36:00
  发帖心情 Post By:2017/2/1 21:47:00 [只看该作者]

经过测试,下面的代码运行正常。
With Tables("表A")
    If .Current Is Nothing Then
        Return
    End If
    
    Dim dlg As New OpenFileDialog
    dlg.MultiSelect = True
    dlg.Filter = "图形文件|*.bmp;*.jpg;*.gif;*.png;*.tif;*.dcm"
    If dlg.ShowDialog = DialogResult.OK Then
        For Each fl As String In dlg.FileNames
            .AddNew()
            Dim dr As DataRow = .Current.DataRow
            If dr.RowState = DataRowState.Added Then '如果是新增行,必须先保存才能插入文件
                dr.Save()
            End If
            .Current.DataRow.SQLInsertFile("文件",fl) '插入文件
            'Dim pic As WinForm.PictureBox = e.Form.Controls("PictureBox1")
            'pic.Image = GetImage(fl)
            'Dim s As String = FileSys.GetName(fl)
            Dim parts() As String = s.split(".")
            .Current("姓名") = parts(0)
            .Current("序号") = Format(Date.Now,"yyyyMMddhhmmss") & "-" & CurrentTable.Rows.Count
        Next
    End If
End With

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/2 9:33:00 [只看该作者]

With Tables("表A")
    If .Current Is Nothing Then
        Return
    End If
   
    Dim dlg As New OpenFileDialog
    dlg.MultiSelect = True
    dlg.Filter = "图形文件|*.bmp;*.jpg;*.gif;*.png;*.tif;*.dcm"
    If dlg.ShowDialog = DialogResult.OK Then
        For Each fl As String In dlg.FileNames
            Dim nr As Row = .AddNew()
            If nr.DataRow.RowState = DataRowState.Added Then '如果是新增行,必须先保存才能插入文件
                nr.Save()
            End If
            nr.DataRow.SQLInsertFile("文件",fl) '插入文件
            Dim pic As WinForm.PictureBox = e.Form.Controls("PictureBox1")
            pic.Image = GetImage(fl)
            Dim s As String = FileSys.GetName(fl)
            Dim parts() As String = s.split(".")
            nr("姓名") = parts(0)
            nr("序号") = Format(Date.Now,"yyyyMMddhhmmss") & "-" & .Rows.Count
        Next
    End If
End With
[此贴子已经被作者于2017/2/2 9:33:18编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
zstk7333
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:328 积分:2960 威望:0 精华:0 注册:2011/5/3 20:21:00
回复:(有点色)With Tables("表A")  &nbs...  发帖心情 Post By:2017/2/2 22:21:00 [只看该作者]

已经试过,可以。
发现另外一个问题:
按照帮助文件”二进制简答示例“中

3、将订单表的CurrentChanged事件代码设置为:

If Forms("窗口1").Opened Then '如果窗口已经打开
    Dim pbx As WinForm.PictureBox = Forms("窗口1").Controls("PictureBox1")
    If Tables("员工").Current Is Nothing Then
        pbx.Image = Nothing
    Else
        pbx.Image = Tables("员工").Current.DataRow.SQlLoadImage("照片") '从后台提取照片并显示
    End
If

End
If


去做查看窗口,就会一直出现之前的提示窗口,这是为什么呢?谢谢


 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/2 23:57:00 [只看该作者]

加上判断

 

If nr.DataRow.RowState = DataRowState.Added Then

    return

End If

'下面写其余的代码


 回到顶部
帅哥哟,离线,有人找我吗?
zstk7333
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:328 积分:2960 威望:0 精华:0 注册:2011/5/3 20:21:00
回复:(有点色)加上判断 If nr.DataRow.Ro...  发帖心情 Post By:2017/2/4 23:45:00 [只看该作者]

谢谢

 回到顶部
总数 15 上一页 1 2