以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  截取字符串  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=159283)

--  作者:爱相随
--  发布时间:2020/12/20 15:51:00
--  截取字符串

老师,下面是截取字符串后四个字符的代码,错在哪里呀

 

If e.DataCol.Name = "银行账户号" Then
  If e.DataRow.IsNull("银行账户号") Then
      e.DataRow("账号") = Nothing
   Else   
      e.DataRow("账号") = SubString.(e.DataRow("银行账户号"),(-4,4))

  End If
End If


--  作者:爱相随
--  发布时间:2020/12/20 15:59:00
--  

谢谢老师,我已经搞对了,代码如下:

Dim s As String = e.DataRow("银行账户号")
If e.DataCol.Name = "银行账户号" Then
  If e.DataRow.IsNull("银行账户号") Then
      e.DataRow("账号") = Nothing
   Else   
      e.DataRow("账号") = (s.SubString(s.Length - 4))
  End If
End If