VB 批量更新查询快递问题
Function kdcx(kd, orderid)Dim Err, url, kdtime, link, Errcode, Status, http, objDom, WebContent, ItemSelect Case kdCase "申通" kd = "shentong"Case "圆通" kd = "yuantong"Case "优速" kd = "yousu"Case "龙邦" kd = "longbang"Case "城市" kd = "cs"Case Else kdcx = "暂时不支持此快递" Exit FunctionEnd SelectSet http = CreateObject("Microsoft.XMLHTTP")url = "http://www.aikuaidi.cn/rest/?key=29fe1030ceaa49ea8d0d7698efd1fd05&order=" & orderid & "&id=" & kd & "&ord=desc&show=xml"http.Open "get", url, Falsehttp.sendWebContent = http.responsetextSet http = NothingSet objDom = CreateObject("Microsoft.XMLDom")objDom.async = FalseobjDom.LoadXML WebContentSet Item = objDom.getElementsByTagName("Root")If Item.Length > 0 Then Select Case Item(0).getElementsByTagName("Status")(0).Text Case "-1" Status = "未更新的单号" Case "0" Status = "查询异常" Case "1" Status = "暂无记录" Case "2" Status = "在途中" Case "3" Status = "派送中" Case "4" Status = "已签收" Case "5" Status = "拒签收" Case "6" Status = "疑难件" Case "7" Status = "无效单" Case "8" Status = "超时单" Case "9" Status = "签收失败" Case Else Status = "快递状态未知情况" End SelectElse Status = "未知错误"End IfSet Item = NothingSet objDom = Nothingkdcx = StatusEnd Function亲测无误,用法示例:
MsgBox kdcx("申通", "768911223344")
Function kdcx(kd, orderid)
Dim Err, url, kdtime, link, Errcode, Status
Select Case kd
Case "申通"
kd = "shentong"
Case "圆通"
kd = "yuantong"
Case "优速"
kd = "yousu"
Case "龙邦"
kd = "longbang"
Case "城市"
kd = "cs"
Case Else
kdcx = "暂时不支持此快递"
Exit Function
End Select
Set http = CreateObject("Microsoft.XMLHTTP")
url = "" & orderid & "&id=" & kd & "&ord=desc&show=xml"
http.Open "get", url, False
http.send
WebContent = http.responsetext
Set objDom = CreateObject("Microsoft.XMLDom")
objDom.async = False
objDom.LoadXML WebContent
Set Item = objDom.getElementsByTagName("Order")
For i = 1 To Item.Length - 1
kdtime = Item(i).getElementsByTagName("Time")(0).Text
link = Item(i).getElementsByTagName("Content")(0).Text
kdcx = kdcx & kdtime & link & vbCrLf
Next
Set Item = Nothing
End Function
Private Sub Command1_Click()
MsgBox kdcx("申通", "768782613057")
End Sub
费蓓卫起: Function kdcx(kd, orderid)Dim Err, url, kdtime, link, Errcode, StatusSelect Case kdCase "申通" kd = "shentong"Case "圆通" kd = "yuantong...
登封市13769928350: VB 运行时 "查询过于复杂" - ?
费蓓卫起: 一般超过WHERE后面条件太多,或者你更新的字段太多就会出现“查询过于复杂”问题,可以使用存储过程,或者分开update,一次一般别超过30个字段
登封市13769928350: 通过《VB语言程序设计》课程的学习,谈谈对本课程的理解,包括 - ?
费蓓卫起: 1、用VB6.0写一个完整的程序,首先需要设计整个程序方案,包括程序设计的目的,程序设计需要实现的功能,程序设计的框架,程序设计的流程等,然后设计程序界面,务必美观人性化,之后便是大量写代码,实现程序的功能,需要注意程...
登封市13769928350: vb+sql快递管理系统 - ?
费蓓卫起: 生成数据库、数据库编辑、打印、认读条形码……
登封市13769928350: 我要制作一个简单VB查询系统,只要输入产品号,就可以调出该货物的所有信息! - ?
费蓓卫起: 你可以适当填加一些内容 Dim adocn As New ADODB.Connection Private Sub Command1_Click() If Text1.Text = "" Then Else Dim rs As New ADODB.Recordset Dim strSql As String strSql = "select * from ss where 学号=" & Trim(Text1.Text)...
登封市13769928350: 在VB中同时执行sql语句select与update - ?
费蓓卫起: 把SQL语句合成一句,把插入、更新、删除语句放在查询前面即可;strSQL = "update 数据表1 set [B]='null';Select * From 数据表1 where [A]='1' " cn.Execute strSQL 返回记录集:Set rs = cn.Execute(strSQL)
登封市13769928350: vb中数据库查询更新增添数据,现有一串数据,前11位是编号,后面依次是各状态 - ?
费蓓卫起: “我需要根据编号来查找是与否由此编号的信息,如果有就更新状态信息,如果没有,新建一行,添加此编号和状态信息.如何在vb中实现”这里能看懂,后半段看不懂 就我看懂的内容来说供触垛吠艹杜讹森番缉,这可以直接靠SQL实现if exists(select * from tablaName where 条件) update tableName set ... where 条件 else insert tableName (字段) values(值)
登封市13769928350: vb.net dataset 数据批量修改 - ?
费蓓卫起: Dim csDataTable as DataTable = csXXDataSet.Tables("Table1")if (not csDataTable is Nothing) then For each csDataRow as DataRow in csDataTable.Rows csDataRow.item("SendOK") = 0 Nextend if
登封市13769928350: 如何在VB中取得的结果集中再进行查询 - ?
费蓓卫起: 这不是VB的问题,而是SQL的问题,使用SELECT...FROM...嵌套就可以实现啊.
登封市13769928350: 在VB中运行查询语句后,提示ADO控件更新错误 - ?
费蓓卫起: 弹出来的对话框是警告吧? 我遇到过这种情况,至少缺少一个参数,一般是由于访问语句有问题,最好检查一下你的查询语句里是否有错误 不是很清楚大概是