我在全局表事件DataRowAdding中增加了以下代码,在实际新增时,没有效果,是什么原因?
'新增时自动赋值默认值
Dim cmd As New SQLCommand
cmd.CommandText = "s elect 字段名,默认值 from abc where 表名 = '" & e.DataTable.Name & "' and isnull(默认值,'') <> '' "
cmd.C
Dim dt As DataTable = cmd.ExecuteReader
If dt.Compute("count(字段名)", "") > 0 Then
For Each dr As DataRow In dt.DataRows
e.DataRow(dr("字段名")) = dr("默认值")
Next
End If
[此贴子已经被作者于2025/1/13 11:37:49编辑过]
没有开启这个事件:
http://www.foxtable.com/webhelp/topics/0671.htm
DataTables("xxx表").GlobalHandler.DataRowAdding = True