错误所在事件:自定义函数,新增后
详细错误信息:
调用的目标发生了异常。
索引超出了数组界限。
内部函数代码:
Dim tbn As String = args(0)
Dim cn As Integer = args(1)
Dim cmd As new SQLC ommand
cmd.Connect i
cmd.Comma ndText = "sele ct * from " & tbn & ""
Dim bt As DataTable
bt = cmd.ExecuteReader(True)
Dim cr As DataRow = bt.Find("id is null")
cr("id") = bt.Compute("Max(id)") + 1
cr("uuid") = Guid.NewGuid.TOstring()
bt.DataCols("更新时间").SetDateTimeFormat(DateTimeFormatEnum.DateLongTime)
cr("更新时间")=Date.Now
cr("创建时间")=Date.Now
If tbn.Contains("填报人信息")=false Then
Dim cmd1 As new SQLC ommand
cmd1.Connecti on Name = "user"
cmd1.Comm andText = "sel ect uuid from 填报人信息 where [id] = " & cn & " " '
Dim bt1 As DataTable
bt1 = cmd1.Execute Reader(True)
Dim Count As Integer = cmd1.ExecuteScalar() '获取总的行数
MessageBox.Show(1)
If count >0 Then
cr("uuid")= bt1.DataCols("uuid")
MessageBox.Show(2)
End If
End If
bt.Save()
当传递过来的表名不是 填报人信息 这个表名的时候 就要从填报人信息这个表名里面去查找cn这个id值对应的数据行 然后获取得到uuid 并赋值给cr("uuid")