太怪了谁能说明白!asp里sql的问题

qxb 2004-08-04 06:04:34
两段代码 在一个库中两个结构相同的access表中
else后的语句不能互用主要是??? 真他妈怪!!

第一个只能用 and prize<>'' 可以查出
第二个只能用 prize IS NULL 才可查出
互换不行

代码
sql = "Select Unid,title,writer,department from jiaoyan where 1 = 1 "


if Request("prize") <>"" then
if Request("prize")=1 then
sql = sql &"and prize<>''"

else
sql = sql &"and prize='' "
end if
end if


sql = "Select Unid,title,writer,department from keyan where 1 = 1 "
if Request("prize") <>"" then
if Request("prize")=1 then
sql = sql &"and prize<>''"

else
sql = sql &"and prize IS NULL "
end if
end if

...全文
83 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hlglyy1688 2004-08-04
  • 打赏
  • 举报
回复
真他妈怪!!,kan lai shi ge guai shou.
ypwyy 2004-08-04
  • 打赏
  • 举报
回复
null和''是不同的概念
dongliu 2004-08-04
  • 打赏
  • 举报
回复
access数据库字段属性有一项是必填字段,还有一项是允许空字符串,你检查一下这两个属性是否一样。

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧