在ASP 写查询问题??

yangcookie 2009-12-14 09:41:31
strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name="&CorrelationUser

rst.Open strsql1,oConn,1,1

strRegTel=""
while not rst.EOF
strRegTel = strRegTel & "," & rst("Reg_MobileTelePhone")
rst.MoveNext
wend

rst.Close
set rst=nothing


为什么查不出来呢?请教!
...全文
78 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
yan11cn 2009-12-14
  • 打赏
  • 举报
回复
if strCycleType <>"0" then strWarning = "1"
CorrelationUser = " <?xml version=""1.0"" encoding=""gb2312""?> <root> <Record> <UserCode>" & replace(CorrelationUser,","," </UserCode> </Record> <Record> <UserCode>") & " </UserCode> </Record> </root>"

这么长的字符串啊。。。。确保字符串中间别多空格 然后
strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name='"&trim(CorrelationUser)&"'"
yangcookie 2009-12-14
  • 打赏
  • 举报
回复
在查询分析器里职可以出来结果。。 就是这里不可以

strsql = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name='"&CorrelationUser&"'"

rst.Open strsql,oConn,1,1

strRegTel = rst("Reg_MobileTelePhone")

rst.Close
set rst=nothing


strRegTel 没有值!
gxq323 2009-12-14
  • 打赏
  • 举报
回复
执行sql能查出来吗?在查询分析器里试试,能查的话注释掉on error resume next再看看
阿非 2009-12-14
  • 打赏
  • 举报
回复
你看看 strsql1 是什么样 ,粘贴一下 在sql 中运行一下
yangcookie 2009-12-14
  • 打赏
  • 举报
回复
strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name='"&CorrelationUser&"'"

rst.Open strsql1,oConn,1,1

strRegTel = rst("Reg_MobileTelePhone")


strRegTel 电话查不出来??
yangcookie 2009-12-14
  • 打赏
  • 举报
回复
没有错 是oConn 可是就是查不出来
帮帮忙


<% Language=VBScript %>
<!--#include file="../Include/isconn.asp"-->
<%
'日程录入保存
set objXML=CreateObject("Microsoft.XMLDOM")
objXML.async=false
objXML.load(Request)

Session.CodePage = 65001
set root = objXML.documentElement.childNodes

strUserCode = session("UserCode")
strUserName=session("UserName")

count = root.length
for i=0 to count-1

strTitle = root.item(i).childNodes.item(0).text
strContent = root.item(i).childNodes.item(1).text
Secrecy = root.item(i).childNodes.item(2).text
CorrelationUser = root.item(i).childNodes.item(3).text
strStartDate = root.item(i).childNodes.item(4).text
strEndDate = root.item(i).childNodes.item(5).text
Sms = root.item(i).childNodes.item(6).text

strWarning = ""
strBefore = "60"
strCycleType = "0"
strCycleContent = ""
strCycleYear = ""

if strCycleType<>"0" then strWarning = "1"

CorrelationUser = "<?xml version=""1.0"" encoding=""gb2312""?><root><Record><UserCode>" & replace(CorrelationUser,",","</UserCode></Record><Record><UserCode>") & "</UserCode></Record></root>"

strsql = "pt_CalendarInsert '"&strTitle&"','"& strContent &"','"& strStartDate &"','"& strEndDate &"','"& strWarning
strsql = strsql &"','"& strBefore &"','"& strUserCode &"','"& Secrecy &"','"& strCycleType &"','"& strCycleContent
strsql = strsql &"','"& strCycleYear &"','"& CorrelationUser &"','"& Sms &"'"
'response.Write strsql
'response.End
oConn.execute(strsql)



strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name='"&CorrelationUser&"'"

rst.Open strsql1,oConn,1,1

strRegTel = rst("Reg_MobileTelePhone")








next





rst.Close
set rst=nothing

oConn.Close
set oConn=nothing
%>
lg7981 2009-12-14
  • 打赏
  • 举报
回复
查询内容要加'',如果是数值型的不用加。

strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name='"&CorrelationUser &"'"
yan11cn 2009-12-14
  • 打赏
  • 举报
回复
有报错么? 数据库连接字段 写的是oConn吗? 还是不小心多加了个o
阿非 2009-12-14
  • 打赏
  • 举报
回复
strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name="&CorrelationUser

=>

strsql1 = "select Reg_mobileTelePhone from JHBJ_Register where Reg_Name='"&CorrelationUser&"'"

28,391

社区成员

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

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