以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 数据不能锁住 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=192951) |
-- 作者:朱女士 -- 发布时间:2024/8/5 8:37:00 -- 数据不能锁住 老师您好! 我的数据表ddqdb中,有一列:清单条码编码,我由access数据源转换成了sqlserver数据源,在合并数据后,清单条码编码的的内容数据发生了变化,我这列数据,是一旦生成,不希望有任何变化。但是这些变化令人不知所措。,请指教锁住这些数据的方法,谢谢!我的表属性datacolchanged代码如下: if e.DataCol.Name="排产日期" If e.DataRow.IsNull("排产日期") Then e.DataRow("清单条码编码") = Nothing Else Dim dl As Date = Date.Today Dim y As Integer = dl.Year Dim m As Integer = dl.Month Dim d As Integer = dl.day Dim Days As Integer = Date.DaysInMonth(y, m) Dim fd As Date = New Date(y, m, 1) \'获得该月的第一天 Dim ld As Date = New Date(y, m, Days) \'获得该月的最后一天 Dim bh As String = Format(dl, "yyyyMMdd") \'生成编号的前6位,4位年,2位月. If e.DataRow("清单条码编码").StartsWith(bh) = False Then\'如果编号的前8位不符 Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(清单条码编码)", "排产日期 >= #" & fd & "# And 排产日期 <= #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify")) \'取得该月的最大编号 If max > "" Then \'如果存在最大编号 idx = CInt(max.Substring(max.length - 4)) + 1 Else idx = 1 \'否则顺序号等于1 End If e.DataRow("清单条码编码") = bh & Format(idx, "0000") End If End If End if |
-- 作者:有点蓝 -- 发布时间:2024/8/5 8:55:00 -- If e.DataRow.IsNull("排产日期") Then e.DataRow("清单条码编码") = Nothing Elseif e.DataRow.IsNull("清单条码编码") …… 另外把代码里的#号改为单引号:http://www.foxtable.com/webhelp/topics/2343.htm
|