我使用以下代码从 azure 表中读取数据。
第一次在 URL2 中我仅发送 mark=0
。
读取第一个数据时,我读取了 nextPartitionKey
和 nextRowKey
的值,以便将它们按顺序包含到 URL2
中
从下一个分区读取下一个数据,因为我一次只能读取 1000 个项目。
第二次使用 URL2
以及 nextPartitionKey
和 nextRowKey
的值,程序读取与第一个分区中相同的数据。在某种程度上它被卡住了。
有人可以看看下面的代码有什么问题吗?
URL2 = "https://data1-dev.azure-api.net/ReadInfo?mark=0"
Set XMLServer = CreateObject("WinHttp.WinHttpRequest.5.1")
Set XMLReceive = CreateObject("Msxml2.DOMDocument.6.0")
XMLServer.SetTimeouts 5000, 60000, 10000, 10000
XMLServer.Option(9) = 2048
XMLServer.Option(6) = True
Do
XMLServer.Open "GET", URL2, False
XMLServer.SetRequestHeader "ID_number", UserID
XMLServer.SetRequestHeader "Key", UserKey
XMLServer.Send ""
ResultText = XMLServer.ResponseText
'I read here the values of nextPartitionKey and nextRowKey from
'ResultText and I save
'them into stNextPartiotionKey and stNextRowKey variables
URL2 = "https://data1-dev.azure-api.net/ReadInfo?Mark=0 &
NextPartitionKey=" &
stNextPartiotionKey & " & NextRowKey=" & stNextRowKey
Loop While stNextPartiotionKey <> "" And stNextRowKey <> ""
最佳答案
我不知道 Azure Table API,但这个 URL...
URL2 = "https://data1-dev.azure-api.net/ReadInfo?Mark=0 & NextPartitionKey=" &
stNextPartiotionKey & " & NextRowKey=" & stNextRowKey
...看起来不对。假设这不是复制粘贴错误,您需要删除“&”符号周围的空格:
URL2 = "https://data1-dev.azure-api.net/ReadInfo?Mark=0&NextPartitionKey=" &
stNextPartiotionKey & "&NextRowKey=" & stNextRowKey
一般来说,网址中的空格永远有效*)。如果 URL 中确实有空格,则需要对其进行编码,例如https://my space url
需要像 https://my%20space%20url
一样编码。
*) 我责怪 Internet Explorer 让人们相信它是有效的,因为它接受这些 URL 并“按原样”在地址栏中显示它们,但在发送时 secret 对其进行编码。另一方面,以 Firefox 为例,它将地址栏中可见的 URL 中的空格转换为 %20
关于azure - 在vb6.0中读取azure表中的数据时如何使用nextPartitionKey和nextRowKey?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71649978/