以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] if语句中,like怎么用?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=157872)

--  作者:5159518
--  发布时间:2020/10/31 16:41:00
--  [求助] if语句中,like怎么用?
If e.Table.Name = "统计"
    If e.Col.IsDate AndAlso e.Col.Name. like "%年度"  \'AndAlso e.Row.IsNull(e.Col) Then
        \'e.Text = Format(e.Row(e.Col), "yyyy年")
MessageBox.Show("年度")
    Else If e.Col.IsDate AndAlso e.Col.Name Like "%月份"  \'AndAlso e.Row.IsNull(e.Col) Then
        \'e.Text = Format(e.Row(e.Col), "yyyy年MM月")
MessageBox.Show("月份")
    Else If e.Col.IsDate AndAlso e.Col.Name Like "%日期"  \'AndAlso e.Row.IsNull(e.Col) Then
        \'e.Text = Format(e.Row(e.Col), "yyyyMMdd")
MessageBox.Show("日期")
    Else If e.Col.IsDate AndAlso e.Col.Name Like "%时间"  \'AndAlso e.Row.IsNull(e.Col) Then
        \'e.Text = Format(e.Row(e.Col), "yyyyMMdd HH:mm")
MessageBox.Show("时间")
    End If
End If

经过测试,e.Col.Name. like "%年度"   没有判断出来,不知道正确的应该怎么写?

--  作者:有点蓝
--  发布时间:2020/10/31 17:15:00
--  
If e.Col.IsDate AndAlso e.Col.Name like "*年度"


--  作者:5159518
--  发布时间:2020/10/31 19:40:00
--  
以下是引用有点蓝在2020/10/31 17:15:00的发言:
If e.Col.IsDate AndAlso e.Col.Name like "*年度"


ok,谢谢,又搞定一个