DataColChanged:
Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
Case "客户名称"
If dr.IsNull("客户名称") Then
Return
Else
dr("客户拼音") = getpy(dr("客户名称"),True)
End If
Case "联系人"
If dr.IsNull("联系人") Then
Return
Else
dr("客户拼音") =getpy(dr("客户名称"),True) & getpy(dr("联系人"),True)
End If
Case "所属_省市"
dr("所属_市") = Nothing
dr("所属_县市") = Nothing
Case "所属_市"
dr("所属_县市") = Nothing
Case "所属_县市"
Dim kfdm As String
Dim xlh As Integer
Dim kfdmdata As DataRow = DataTables("营销部").Find(" 市场片区_省市 = '" & e.DataRow("所属_省市") & "' and 市场片区_县市 = '" & e.DataRow("所属_县市") &"'")
kfdm = kfdmdata("市场代码")
kfdm = kfdm.trim()
Dim last As new SQLCommand
Dim last2 As new SQLCommand
With last
.ConnectionName = "销售系统"
.CommandText = "select [顺序号] from {编号} where [前缀] = '"& kfdm &"' and [表名] = '客户档案'"
End With
last2.ConnectionName = "销售系统"
Do
xlh = last.ExecuteScalar()
With last2
.CommandText = "update {编号} set [顺序号] = " & ( xlh +1) & " where [前缀] = '" & kfdm & "'and [表名] = '客户档案' "
End With
If last2.ExecuteNonQuery() > 0 Then
Exit Do
End If
Loop
dr("客户简码") = kfdm & "-" & Format(xlh,"0000")
dr("地址") = dr("所属_省市") & dr("所属_市") & dr("所属_县市")
End Select
此主题相关图片如下:11.jpg