52,780
社区成员
发帖
与我相关
我的任务
分享sql="SELECT A.myfriendpic,B.giftimage,C.gamepath FROM myfriend A,gift B,game C WHERE A.uid='"&uid&"' AND B.uid='"&uid&"' AND C.uid='"&uid&"' AND (A.myfriendpic LIKE '%"&src&"%' or B.giftimage LIKE '%"&src&"%' or C.gamepath LIKE '%"&src&"%')"
set rs=conn.execute(sql)
dim str
do while not rs.eof
myfriendpic = rs(0) & ""
giftimage = rs(1) & ""
gamepath = rs(2) & ""
myfriendpic=DealCharactor(myfriendpic,0)
giftimage=DealCharactor(giftimage,0)
gamepath=DealCharactor(gamepath,0)
uid=""&uid&""
src=DealCharactor(src,0)
if NeedUpdate(src, myfriendpic) then str = "SET myfriendpic='" & DealCharactor(Replace(myfriendpic, src, ""), 1) & "'"
if NeedUpdate(src, giftimage) then
if str = "" then
str = "SET giftimage='" & DealCharactor(Replace(giftimage, src, ""), 1) & "'"
else
str = str & ",giftimage='" & DealCharactor(Replace(giftimage, src, ""), 1) & "'"
end if
end if
if NeedUpdate(src, gamepath) then
if str = "" then
str = "SET gamepath='" & DealCharactor(Replace(gamepath, src, ""), 1) & "'"
else
str = str & ",gamepath='" & DealCharactor(Replace(gamepath, src, ""), 1) & "'"
end If
end If
......
sql=不知咋写?
conn.execute sql
rs.movenext
loop
STR=trim(request("str")) '首先获取页面传过来的值
CaseTable="" '设一个变量,用来确认传过来的值是表1的还是表2的还是表3的
set rs=server.creatObject("ADODB.Recordset")
sql="select * from 表1 where 表1字段 like '%"&STR&"%'"
rs.open sql,conn,1,1
if not rs.eof or rs.bof then
CaseTable=1 '这里表示这个字段是属于表1的
end if
rs.close
sql="select * from 表2 where 表2字段 like '%"&STR&"%'"
rs.open sql,conn,1,1
if not rs.eof or rs.bof then
CaseTable=2 '这里表示这个字段是属于表2的
end if
rs.close
sql="select * from 表3 where 表3字段 like '%"&STR&"%'"
rs.open sql,conn,1,1
if not rs.eof or rs.bof then
CaseTable=3 '这里表示这个字段是属于表3的
end if
rs.close
'response.write(CaseTable) '这样我们就知道你传过来的值是属于哪个表了
'然后我们就能根据CaseTable的值去决定UPDATE哪个表了
if CaseTable=1 then
sql="Update 表1 ....."
elseif CaseTable=2 then
sql="Update 表2 ....."
elseif CaseTbale=3 then
sql="Update 表3 ....."
end if
'response.write(sql) 得到相应的SQL语句
Conn.execute(sql) '执行相应的SQL语句