以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请教有点甜老师,关于RemoteSmS,急! (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=53952) |
-- 作者:zhy400137 -- 发布时间:2014/7/18 15:11:00 -- 请教有点甜老师,关于RemoteSmS,急! 有点甜老师: 你好!看了你关于RemoteSmS的贴子,想改成批量工资条发短信的应用,但发现用循环后只能出去二条 记录,第三条就会出错,想请你指点下,谢谢! Dim server As String = e.Form.Controls("TextBox1").Text Dim MsPhone As String Dim context As String For Each dr As DataRow In DataTables("表A").DataRows Dim phone As String = dr("手机号") For Each dc As DataCol In DataTables("表A").DataCols If dc.name<>"手机号" Then context = context & dc.name & ": " & dr(dc.name) & " " End If Next context=System.Web.HttpUtility.UrlEncode(context.TrimEnd) Dim url As String = server & "/?numbers=" & phone & "&text=" & context try Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url) Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse catch ex As exception MsPhone = MsPhone & dr("手机号") & "," End try cfont-family: Verdana; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "> url="" Next MessageBox.Show(MsPhone & "发送失败,请确认服务器地址设置正确!","提示")
|
-- 作者:zhy400137 -- 发布时间:2014/7/18 15:15:00 -- 有个地方乱码了,重贴一下! Dim server As String = e.Form.Controls("TextBox1").Text Dim MsPhone As String Dim context As String For Each dr As DataRow In DataTables("表A").DataRows Dim phone As String = dr("手机号") For Each dc As DataCol In DataTables("表A").DataCols If dc.name<>"手机号" Then context = context & dc.name & ": " & dr(dc.name) & " " End If Next context=System.Web.HttpUtility.UrlEncode(context.TrimEnd) Dim url As String = server & "/?numbers=" & phone & "&text=" & context try Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url) Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse catch ex As exception MsPhone = MsPhone & dr("手机号") & "," End try c" Next MessageBox.Show(MsPhone & "发送失败,请确认服务器地址设置正确!","提示")
|
-- 作者:有点甜 -- 发布时间:2014/7/18 15:15:00 -- 不应该,试试这样
Dim server As String = e.Form.Controls("TextBox1").Text For Each dr As DataRow In DataTables("表A").DataRows |
-- 作者:zhy400137 -- 发布时间:2014/7/18 15:17:00 -- 额C‘’处是清空context和URL,不清楚为什么贴上来就会变了! |
-- 作者:zhy400137 -- 发布时间:2014/7/18 15:22:00 -- 还是只是会两条,我的软件是在机锋上下的,是不是版本有问题? |
-- 作者:有点甜 -- 发布时间:2014/7/18 15:22:00 -- 看3楼,可能是字符过长了,再试一试。
如果还报错,加入代码测试报什么错
catch ex As exception msgbox(ex.Message) |
-- 作者:zhy400137 -- 发布时间:2014/7/18 15:27:00 -- 提示:发送失败,请确认服务器地址设置正确 晕了,唉!
|
-- 作者:zhy400137 -- 发布时间:2014/7/18 15:30:00 -- 提示 操作超时! |
-- 作者:有点甜 -- 发布时间:2014/7/18 15:47:00 -- 呵呵,忘记关闭了,抱歉
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url) |
-- 作者:zhy400137 -- 发布时间:2014/7/18 16:12:00 -- 搞定,非常感谢! |