如何连接判断字符新方法,如:where id0 and username="" and ......2006-6-8-3

sql="select * from tables  where id<>0 "
if uid<>"" then sql=sql&" and uid=1 "
if uid2<>"" then sql=sql&" and uid2=1 "
if uid3<>"" then sql=sql&" and uid3=1 "

上边的连接是大家常用到的,下边是针对排序的.

if uid="1" then ostr=ostr&" ,uid desc "
if uid="2" then ostr=ostr&" ,uid  "
if uid2="1" then ostr=ostr&" ,uid2 desc "
if uid2="2" then ostr=ostr&" ,uid2  "
if uid3="1" then ostr=ostr&" ,uid3 desc "
if uid3="2" then ostr=ostr&" ,uid 3 "
ostr=mid(ostr,1)            '这一步的作用是,以前的取排序操作字段的时候没有考虑:这个字段前边是不是已经有一个了,现在不用考虑,直接写到最后把前边的那个", "用mid去掉就行
if len(trim(ostr))<>0 then
  sql=sql&" order by "&ostr
  end if

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值