以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- Not Like 为什么不能用 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=141069) |
-- 作者:Frachy -- 发布时间:2019/9/20 17:04:00 -- Not Like 为什么不能用 版主和狐友们: 在事件编程中,想在 If 语句中用 Not Like,但是为什么会提示错误呢? If e.DataCol.Name = "折扣" Then \'如果是折扣列的内容发生变化. If ((e.DataRow("客户") Like "*CS*" Or e.DataRow("客户") Like "*BS*")=0) And e.NewValue > 0.15 Then \'如果输入的内容大于0.15. e.DataRow("折扣范围") = 0.221 \'那么改为0.15. End If End If 上面代码可以正常使用 If e.DataCol.Name = "折扣" Then \'如果是折扣列的内容发生变化. If ((e.DataRow("客户") Not Like "*CS*" Or e.DataRow("客户") Like "*BS*")=0) And e.NewValue > 0.15 Then \'如果输入的内容大于0.15. e.DataRow("折扣范围") = 0.221 \'那么改为0.15. End If End If 加了个Not就提示错误 我看说明书的“条件表达式”章节,说道: 可以在Like前面加上Not关键词,表示不类似的意思,例如: 姓名 Not Like \'李%\' 但是这里就不能用,为什么呢?请指教,谢谢。 |
-- 作者:有点蓝 -- 发布时间:2019/9/20 17:10:00 -- 此like(http://www.foxtable.com/webhelp/topics/0222.htm)非彼like(http://www.foxtable.com/webhelp/topics/0102.htm),完全不是一回事,一个是代码语法,一个是表达式语法 If e.DataCol.Name = "折扣" Then \'如果是折扣列的内容发生变化. If ( Not (e.DataRow("客户") Like "*CS*") Or e.DataRow("客户") Like "*BS*") And e.NewValue > 0.15 Then \'如果输入的内容大于0.15. e.DataRow("折扣范围") = 0.221 \'那么改为0.15. End If End If |