以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于PrepareEdit的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=120108)

--  作者:huangxueyao
--  发布时间:2018/6/7 10:48:00
--  关于PrepareEdit的问题
表的类型SQLtable
通过DataTableBuilder建的临时表再绑定到控件

PrepareEdit事件无反应

以下是代码:


If e.IsFocusCell Then
    If e.Col.Name = "入仓仓库" Then
        Dim cmd As new SQLcommand
        cmd.c
        cmd.commandtext = "sel ect 仓库编号,仓库名称 from 仓库资料表 where 物料类型 = \'" & e.Row("物料类型") & "\' and 审核状态 = \'2\'"
        Dim db As DataTable = cmd.executereader
        If db.DataRows.count > 0 Then
            e.Col.ComboList = db.GetComboListString("仓库编号")
        Else
            e.Col.ComboList = "未找到可用仓库|0"
        End If
    End If
End If

--  作者:有点甜
--  发布时间:2018/6/7 11:15:00
--  

1、在prepareEdit写这种代码是错误的做法。这个事件是每时每刻都在执行的。

 

2、通过datasource绑定的表格,都是副本表,不是sqlTable或者sqlQuery表,写代码都要写到【全局表事件】去。

 

3、获取【仓库资料表】的值,尽量把资料表加载出来,不然每次后台获取很耗时的。