Foxtable(狐表)用户栏目专家坐堂 → 求助精简代码


  共有4428人关注过本帖树形打印复制链接

主题:求助精简代码

帅哥哟,离线,有人找我吗?
小兵
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:11 积分:170 威望:0 精华:0 注册:2013/6/2 18:43:00
求助精简代码  发帖心情 Post By:2013/6/4 17:58:00 [只看该作者]

Select Case e.DataCol.Name
Case "罪名"
If e.DataRow("罪名") Like "盗窃*" Then
e.DataRow("犯罪类型")="财产型"
ElseIf e.DataRow("罪名") Like "诈骗" Then
e.DataRow("犯罪类型") = "财产型"
ElseIf e.DataRow("罪名") Like "*诈骗*" Then
e.DataRow("犯罪类型")="财产型"
ElseIf e.DataRow("罪名") Like "*贪污*" Then
e.DataRow("犯罪类型")="财产型"
ElseIf e.DataRow("罪名") Like "*侵占*" Then
e.DataRow("犯罪类型") = "职务犯罪"
ElseIf e.DataRow("罪名") Like "*强奸*" Then
e.DataRow("犯罪类型")="淫欲型"
ElseIf e.DataRow("罪名") Like "*伤害*"  Then
e.DataRow("犯罪类型")="暴力型"
ElseIf e.DataRow("罪名") Like "*抢*" Then
e.DataRow("犯罪类型")="暴力型"
ElseIf e.DataRow("罪名") Like "*杀人*" Then
e.DataRow("犯罪类型") = "暴力型"
ElseIf e.DataRow("罪名") Like "*死*" Then
e.DataRow("犯罪类型") = "暴力型"
ElseIf e.DataRow("罪名") Like "*敲诈*" Then
e.DataRow("犯罪类型") = "暴力型"
ElseIf e.DataRow("罪名") Like "*淫*" Then
e.DataRow("犯罪类型") = "淫欲型"
Else
e.DataRow("犯罪类型")="其他型"
End If
End Select
这段代码怎么精简啊

 回到顶部
帅哥哟,离线,有人找我吗?
don
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12993 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2013/6/4 18:46:00 [只看该作者]

Select Case e.DataCol.Name
    Case "罪名"
        Dim s1 As String = e.DataRow("罪名")
        Dim n1 As Integer
        If s1 = Nothing Then
            n1 = 1
        ElseIf "盗窃*|诈骗|贪污".Contains(s1) Then
            n1 =2
        ElseIf "伤害|抢|杀人|死|敲诈".Contains(s1) Then
            n1 =3
        ElseIf "淫|强奸".Contains(s1) Then
            n1 =4
        ElseIf "侵占".Contains(s1)  Then
            n1 =5
        Else
            n1 =6
        End If
        e.DataRow("犯罪类型") = choose(n1,"","财产型","暴力型","淫欲型", "职务犯罪","其他型")
End Select

 回到顶部