PB数据窗口保存前删除空行(转)
在UpdateStart事件中添加以下代码:Long ll_row
FOR ll_row = RowCount() To 1 Step -1
If ((IsNull(Object.part_no)) Or (Object.part_no = "")) THEN
SetRow(ll_row)
DeleteRow(0)
CONTINUE
END IF
NEXT
RETURN
测试成功,可用 SQLserver产生的空行,setfilter(" not isnull(col)")还过滤不掉,而且find找到的始终是空行,最后只有删除空行才行 本帖最后由 swimchen 于 2023-9-25 05:38 编辑
THIS.SetRedraw(False) //加速界面显示
LONG ll_Row
FOR ll_Row=THIS.RowCount() TO 1 STEP -1
IF THIS.GetItemStatus(ll_Row,0,Primary!)=New! THEN THIS.RowsDiscard(ll_Row,ll_Row,Primary!) //RowsDiscard和DeleteRow的区别是DeleteRow会生成Delete SQL
NEXT
FOR ll_Row=THIS.FilteredCount() TO 1 STEP -1
IF THIS.GetItemStatus(ll_Row,0,Filter!)=New! THEN THIS.RowsDiscard(ll_Row,ll_Row,Filter!)
NEXT
THIS.SetRedraw(True)
THIS.SetRedraw(False) //加速界面显示 LONG ll_Row FOR ll_Row=THIS.RowCount() TO 1 STEP -1 IF THIS.GetItemStatus(ll_Row,0,Primary!)=New! THEN THIS.RowsDiscard(ll_Row,ll_Row,Primary!) //RowsDiscard和DeleteRow的区别是DeleteRow会生成Delete SQL NEXT FOR ll_Row=THIS.FilteredCount() TO 1 STEP -1 IF THIS.GetItemStatus(ll_Row,0,Filter!)=New! THEN THIS.RowsDiscard(ll_Row,ll_Row,Filter!) NEXT THIS.SetRedraw(True)
页:
[1]