我使用的是外部数据源,但是在一开始建立数据库时并没有建立_Identify列,在FT中操作建立外部数据源后编辑项目,发现需要使用_Identify列,然后在数据库程序中建立了_Identify列,这时,在FT中不能看到_Identify列,请问这时我该如何操作?
在项目运行时出现图片错误,请问是由于_Identify列引起的么?
代码如下:
If e.DataCol.Name = "申报单号" Then
Dim nms() As String = { "货主","货主电话","品种","数量","单位","用途","启运地_省","启运地_市","启运地_区","启运地_街","启运地_村","启运地_号","启运地_户","到达地_省","到达地_市","到达地_区","到达地_街","到达地_村","到达地_号","启运时间" }
If e.NewValue Is Nothing Then
For Each nm As String In nms
e.DataRow(nm) = Nothing
Next
Else
Dim dr As DataRow
dr = DataTables("动物申报").Find("[申报单号] = '" & e.NewValue & "'")
If dr IsNot Nothing
For Each nm As String In nms
e.DataRow(nm) = dr(nm)
Next
End If
End If
End If
If e.DataRow.IsNull("货主")=False AndAlso e.DataRow.IsNull("货主电话")=False AndAlso e.DataRow.IsNull("承运人")=False AndAlso e.DataRow.IsNull("承运人电话")=False AndAlso e.DataRow.IsNull("运载牌照号")=False Then
Dim dr As DataRow = DataTables("货主信息").Find( "货主='" & e.DataRow("货主") & "' And 货主电话='" & e.DataRow("货主电话") & "' And 承运人='" & e.DataRow("承运人") & "' And 承运人电话='" & e.DataRow("承运人电话") & "' and 运载牌照号='" & e.DataRow("运载牌照号") & "'")
If dr Is Nothing Then
Dim dr2 As DataRow = DataTables("货主信息").addnew
dr2("货主")=e.DataRow("货主")
dr2("货主电话")= e.DataRow("货主电话")
dr2("承运人")=e.DataRow("承运人")
dr2("承运人电话")=e.DataRow("承运人电话")
dr2("运输牌照号")=e.DataRow("运载牌照号")
End If
End If
If e.DataCol.Name = "数量" OrElse e.DataCol.Name = "单位" Then
e.DataRow("数量单位") = CUNumber(e.DataRow("数量")) & e.DataRow("单位")
End If
If e.DataCol.Name = "启运时间" Then
Dim s As String = Format(e.DataRow("启运时间"), "yyyy-MM-dd")
e.DataRow("启运时间_年") = CLDate(e.DataRow("启运时间")).SubString(0,4)
Dim md As String = CLDate(e.DataRow("启运时间")).SubString(5).trimend("日")
Dim Parts() As String = md.Split("月")
e.DataRow("启运时间_月") = Parts(0)
e.DataRow("启运时间_日") = Parts(1)
End If
If e.DataCol.name="申报单号" AndAlso e. DataRow.isnull("申报单号")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("申报单号")=e.DataRow("申报单号")
End If
dr("申报单号")=e.DataRow("申报单号")
End If
If e.DataCol.name="检疫证号" AndAlso e. DataRow.isnull("检疫证号")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("检疫证号")=e.DataRow("检疫证号")
End If
dr("检疫证号")=e.DataRow("检疫证号")
End If
If e.DataCol.name="货主" AndAlso e. DataRow.isnull("货主")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("货主")=e.DataRow("货主")
End If
dr("货主")=e.DataRow("货主")
End If
If e.DataCol.name="品种" AndAlso e. DataRow.isnull("品种")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("品种")=e.DataRow("品种")
End If
dr("品种")=e.DataRow("品种")
End If
If e.DataCol.name="数量" AndAlso e. DataRow.isnull("数量")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("数量")=e.DataRow("数量")
End If
dr("数量")=e.DataRow("数量")
End If
If e.DataCol.name="启运地" AndAlso e. DataRow.isnull("启运地_村")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("启运地")=e.DataRow("启运地_村")
End If
dr("启运地")=e.DataRow("启运地_村")
End If
If e.DataCol.name="到达地" AndAlso e. DataRow.isnull("到达地_村")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("到达地")=e.DataRow("到达地_村")
End If
dr("到达地")=e.DataRow("到达地_村")
End If
If e.DataCol.name="用途" AndAlso e. DataRow.isnull("用途")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("用途")=e.DataRow("用途")
End If
dr("用途")=e.DataRow("用途")
End If
If e.DataCol.name="日期" AndAlso e. DataRow.isnull("启运时间")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("日期")=e.DataRow("启运时间")
End If
dr("日期")=e.DataRow("启运时间")
End If
If e.DataCol.name="检疫员" AndAlso e. DataRow.isnull("检疫员")=False Then
Dim dr As DataRow = DataTables("检疫记录").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("检疫记录").addnew
dr("ID") = e.DataRow("_Identify")
dr("检疫员")=e.DataRow("检疫员")
End If
dr("检疫员")=e.DataRow("检疫员")
End If
'写到养殖户补出栏信息表
If e.DataCol.name="编号" AndAlso e. DataRow.isnull("编号")=False Then
Dim dr As DataRow = DataTables("养殖户补出栏信息").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("养殖户补出栏信息").addnew
dr("ID") = e.DataRow("_Identify")
dr("编号")=e.DataRow("编号")
End If
dr("编号")=e.DataRow("编号")
End If
If e.DataCol.name="品种" AndAlso e. DataRow.isnull("品种")=False Then
Dim dr As DataRow = DataTables("养殖户补出栏信息").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("养殖户补出栏信息").addnew
dr("ID") = e.DataRow("_Identify")
dr("品种")=e.DataRow("品种")
End If
dr("品种")=e.DataRow("品种")
End If
If e.DataCol.name="出栏_检疫" AndAlso e. DataRow.isnull("数量")=False Then
Dim dr As DataRow = DataTables("养殖户补出栏信息").Find("ID = " & e.DataRow("_Identify"))
If dr Is Nothing Then
dr = DataTables("养殖户补出栏信息").addnew
dr("ID") = e.DataRow("_Identify")
dr("出栏_检疫")=e.DataRow("数量")
End If
dr("出栏_检疫")=e.DataRow("数量")
End If
此主题相关图片如下:错误3.png