| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 530 人关注过本帖
标题:vb+http+xmlhttp返回无法读出问题
只看楼主 加入收藏
ccbwx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-12-4
结帖率:0
收藏
 问题点数:0 回复次数:0 
vb+http+xmlhttp返回无法读出问题
共分vb代码 和 putsingleinfo.asp代码
记录能成功添加时数据库,就是无法获取到返回成功的提示retval变量

提示实时错误 ‘91’  对象变量或with块变量未设置
请哪位大侠帮看看,谢谢喽!!!

知道vb在执行这句时程序报错了
strretval = ResponseXml.selectSingleNode("retval").Text
但是不知道原因,不会改呀,5555 ,谢谢,各位大侠帮改一改

下面这段是vb代码
Private Sub Command1_Click()
    Dim httpRequest As MSXML2.XMLHTTP30

    Set httpRequest = New MSXML2.XMLHTTP30
    Dim strXML     As String
    '构造出要上传的XML串,这里节点使用中文
    strXML = "<Request>" & _
                      "<youid>" & Text1.Text & "</youid>" & _
                      "<youname>" & Text2.Text & "</youname>" & _
                      "<youpwd>" & Text3.Text & "</youpwd>" & _
                      "</Request>"
    Text4.Text = strXML
    httpRequest.Open "POST", "http://localhost/putsingleinfo.asp", False
    httpRequest.send strXML
   
    '如果错误
    If httpRequest.Status <> 200 Then
        MsgBox httpRequest.statusText, , httpRequest.Status
        Exit Sub
    End If
   
    '以下是判断数据是否正确提交
    Dim strretval As String
    Dim ResponseXml As DOMDocument
    Set ResponseXml = New DOMDocument
    Set ResponseXml = httpRequest.ResponseXml
    ' 执行到下面一句出错!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    strretval = ResponseXml.selectSingleNode("retval").Text
    MsgBox strretval
End Sub

‘下面是putsingleinfo.asp代码
<%@ Language=VBScript %>

<%
Response.ContentType = "text/xml"
Set conn = Server.CreateObject("ADODB.connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq= " & Server.MapPath("lqdf.mdb")

  Dim xmldom
  Set xmldom = Server.CreateObject("MSXML.DOMDocument")
  xmldom.Load Request

  Dim youid, youname, youpwd
  youid = xmldom.selectSingleNode("//youid").Text
  youname = xmldom.selectSingleNode("//youname").Text
  youpwd = xmldom.selectSingleNode("//youpwd").Text

  Dim strsql, retval
  On Error Resume Next
  strsql = "insert into user(youid,youname,youpwd) values( '" & youid & " ','" & youname & "

','" & youpwd & " ')"
  conn.Execute strsql
  response.Write Err.Number
  If Err.Number = 0 Then
    retval = "数据成功提交 "
  Else
    retval = "数据提交失败,请检查你的数据 "
  End If
  
  Set xmldom = Nothing
  Set conn = Nothing
%>
<?xml version="1.0" encoding="gb2312" ?>
<Response>
<retval><%=retval%></retval>
</Response>
源码上传了,请大侠帮改一改,谢谢!
http://pan.baidu.com/s/1mgt31zi
搜索更多相关主题的帖子: 数据库 记录 
2014-03-20 00:15
快速回复:vb+http+xmlhttp返回无法读出问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040846 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved