If e.DataCol.name = "科目代码" Then If e.DataRow.IsNull("科目代码") Then e.DataRow("会计科目_一级科目") = "" e.DataRow("会计科目_明细科目") = "" Else Dim str As String = e.DataRow("科目代码") If str.Length = 4 Then Dim dr As DataRow = DataTables("会计科目").find("科目代码 = '"& e.datarow("科目代码") & "'") If dr IsNot Nothing Then e.DataRow("会计科目_一级科目") = dr("科目名称") End If e.DataRow("会计科目_明细科目") = "" Else Dim str1 As String = str.SubString(0,4) Dim dr1 As DataRow = DataTables("会计科目").find("科目代码 = '"& str1 & "'") If dr1 IsNot Nothing Then e.DataRow("会计科目_一级科目") = dr1("科目名称") End If Dim dr2 As DataRow = DataTables("会计科目").find("科目代码 = '"& str & "'") If dr2 IsNot Nothing Then e.DataRow("会计科目_明细科目") = dr2("科目名称") End If End If End If End If
|