asp中的组成字符串问题!!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/21 16:49:38
<%
pk = request("pk") ''主键

''********修改时先添好被修改信息.***************
set rs=Server.CreateObject("Adodb.Recordset")
set rs1=server.createobject("adodb.recordset")
sql="select * from VIEW3 where ID="& pk
rs.open sql,conn,1,1
if rs.eof then
salert "数据库出错!!"
response.end
else
title = rs("title")
content = rs("content")
receiver = rs("receiver")
sender = rs("sender")
Expr1 = rs("Expr1")
tdate = rs("tdate")

end if
rs1.open "select * from VIEW3 where title='"&rs("title")&"' and content='"&rs("content")&"' and sender='"&rs("sender")&"' and tdate='"&rs("tdate")&"'",conn,1,3
dim outStr
outStr=""
if not rs1.e

检查rs1.open 是否检索到数据,即输出一下rs1.RecordCount的值

你想做什么功能?
重复记录删除还是?

outStr=outStr+rs1("name")+","

这里的写法有问题.你这样写根本取不出所有的记录的组合.

楼主,你很强呢~~~~~title='"&rs("title")&"' and content='"&rs("content")&"' and sender='"&rs("sender")&"' and tdate='"&rs("tdate")&"'
不知道你这些字符串里都放的什么东东,那么多字符串全部都要相同,条件很高,是不是你的SQL语句执行后就没记录~~~~

outStr=mid(outStr,1,len(outStr)-1) 语句没问题的。。。。呵呵,有时候不是取不出来值,而是有可能没有值!

再给你点参考资料
---------------------------------------------------
Mid(string, start[, length])

参数 描述
·start string 中被提取的字符部分的开始位置。如果 start 超过了 string 中字符的数目,Mid 将返回零长度字符串 ("")。