Foxtable(狐表)用户栏目专家坐堂 → [求助]


  共有3774人关注过本帖树形打印复制链接

主题:[求助]

帅哥哟,离线,有人找我吗?
yjd
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:183 积分:1434 威望:0 精华:0 注册:2014/11/7 21:15:00
[求助]  发帖心情 Post By:2015/1/11 21:34:00 [只看该作者]

老师,短信群发代码怎么写,发一个短信点一下鼠标太麻烦,谢谢!
For Each r As Row In Tables("对公客户明细").rows
    Dim server As String = e.Form.Controls("TextBox1").Text
    Dim phones As String = r("手机")
    Dim context As String = System.Web.HttpUtility.UrlEncode(e.Form.Controls("TextBox3").Text)
    If phones > "" AndAlso context > "" Then '如果输入了电话号码和内容
        e.Form.Controls("btnSend").Enabled = False '禁用发送按钮,避免用户重复单击发送按钮
    End If
    Dim url  As String = server & "/?numbers=" & phones & "&text=" & context
    try
        Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
        Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
        rsps.close
        'Dim stm As System.IO.Stream = rsps.GetResponseStream()
        'Dim reader As New System.IO.StreamReader(stm)
        'Dim strResult As String = reader.ReadToEnd
        'msgbox(strResult)
        msgbox("提交发送成功")
    catch ex As exception
        msgbox("发送失败,请确认服务器地址设置正确!")
    End try
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/11 21:49:00 [只看该作者]

方法一

 


Dim server As String = e.Form.Controls("TextBox1").Text
Dim phones As String = ""
For Each r As Row In Tables("对公客户明细").rows
    phones &= r("手机") & ","
Next
Dim context As String = System.Web.HttpUtility.UrlEncode(e.Form.Controls("TextBox3").Text)
If phones > "" AndAlso context > "" Then '如果输入了电话号码和内容
    e.Form.Controls("btnSend").Enabled = False '禁用发送按钮,避免用户重复单击发送按钮
End If
Dim url  As String = server & "/?numbers=" & phones.Trim(",") & "&text=" & context
try
    Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
    Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
    rsps.close
    'Dim stm As System.IO.Stream = rsps.GetResponseStream()
    'Dim reader As New System.IO.StreamReader(stm)
    'Dim strResult As String = reader.ReadToEnd
    'msgbox(strResult)
    msgbox("提交发送成功")
catch ex As exception
    msgbox("发送失败,请确认服务器地址设置正确!")
End try


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/11 21:52:00 [只看该作者]

 方法二

 

Dim MsPhone As String = ""
For Each r As Row In Tables("对公客户明细").rows
    Dim server As String = e.Form.Controls("TextBox1").Text
    Dim phones As String = r("手机")
    Dim context As String' = System.Web.HttpUtility.UrlEncode(e.Form.Controls("TextBox3").Text)
   
    Dim url  As String = server & "/?numbers=" & phones & "&text=" & context
    try
        Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
        Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
        rsps.close
        'Dim stm As System.IO.Stream = rsps.GetResponseStream()
        'Dim reader As New System.IO.StreamReader(stm)
        'Dim strResult As String = reader.ReadToEnd
        'msgbox(strResult)
    catch ex As exception
        MsPhone = MsPhone & r("手机号") & ","
    End try
Next
If msPhone > "" Then
    MessageBox.Show(MsPhone & "发送失败,请确认服务器地址设置正确!","提示")
End If


 回到顶部
帅哥哟,离线,有人找我吗?
yjd
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:183 积分:1434 威望:0 精华:0 注册:2014/11/7 21:15:00
  发帖心情 Post By:2015/1/11 22:03:00 [只看该作者]

Dim server As String = e.Form.Controls("TextBox1").Text
Dim phones As String = ""
For Each r As Row In Tables("对公客户明细").rows
    phones &= r("手机") & ","
Next
Dim context As String = System.Web.HttpUtility.UrlEncode(e.Form.Controls("TextBox3").Text)
If phones > "" AndAlso context > "" Then '如果输入了电话号码和内容
    e.Form.Controls("btnSend").Enabled = False '禁用发送按钮,避免用户重复单击发送按钮
End If
Dim url  As String = server & "/?numbers=" & phones.Trim(",") & "&text=" & context
try
    Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
    Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
    rsps.close
    'Dim stm As System.IO.Stream = rsps.GetResponseStream()
    'Dim reader As New System.IO.StreamReader(stm)
    'Dim strResult As String = reader.ReadToEnd
    'msgbox(strResult)
    msgbox("提交发送成功")
catch ex As exception
    msgbox("发送失败,请确认服务器地址设置正确!")
End try

老师,只发了一条。我搞不清了!

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/11 22:05:00 [只看该作者]

 哦,写错了

 

For Each r As Row In Tables("对公客户明细").rows
    phones &= r("手机") & "|"
Next

 

 

Dim url  As String = server & "/?numbers=" & phones.Trim("|") & "&text=" & context


 回到顶部
帅哥哟,离线,有人找我吗?
yjd
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:183 积分:1434 威望:0 精华:0 注册:2014/11/7 21:15:00
  发帖心情 Post By:2015/1/11 22:25:00 [只看该作者]

Dim server As String = e.Form.Controls("TextBox1").Text
Dim phones As String = ""
For Each r As Row In Tables("对公客户明细").rows
    phones &= r("手机") & "|"
Next
Dim context As String = System.Web.HttpUtility.UrlEncode(e.Form.Controls("TextBox3").Text)
If phones > "" AndAlso context > "" Then '如果输入了电话号码和内容
    e.Form.Controls("btnSend").Enabled = False '禁用发送按钮,避免用户重复单击发送按钮
End If
Dim url  As String = server & "/?numbers=" & phones.Trim("|") & "&text=" & context
try
    Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
    Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
    rsps.close
    'Dim stm As System.IO.Stream = rsps.GetResponseStream()
    'Dim reader As New System.IO.StreamReader(stm)
    'Dim strResult As String = reader.ReadToEnd
    'msgbox(strResult)
    msgbox("提交发送成功")
catch ex As exception
    msgbox("发送失败,请确认服务器地址设置正确!")
End try


老师,只发了一条。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/11 22:27:00 [只看该作者]

 不可能。

 

 那你就用方法二。


 回到顶部
帅哥哟,离线,有人找我吗?
yjd
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:183 积分:1434 威望:0 精华:0 注册:2014/11/7 21:15:00
  发帖心情 Post By:2015/1/11 23:15:00 [只看该作者]

Dim server As String = e.Form.Controls("TextBox1").Text
Dim phones As String = ""
For Each r As Row In Tables("对公客户明细").rows
    phones &= r("手机") & "|"
Next
Dim context As String = System.Web.HttpUtility.UrlEncode(e.Form.Controls("TextBox3").Text)
If phones > "" AndAlso context > "" Then '如果输入了电话号码和内容
    e.Form.Controls("btnSend").Enabled = False '禁用发送按钮,避免用户重复单击发送按钮
End If
Dim url  As String = server & "/?numbers=" & phones.Trim("|") & "&text=" & context
try
    Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
    Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
    rsps.close
    'Dim stm As System.IO.Stream = rsps.GetResponseStream()
    'Dim reader As New System.IO.StreamReader(stm)
    'Dim strResult As String = reader.ReadToEnd
    'msgbox(strResult)
    msgbox("提交发送成功")
catch ex As exception
    msgbox("发送失败,请确认服务器地址设置正确!")
End try


您看有问题吗?只发送了一条。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/11 23:43:00 [只看该作者]

 代码没问题,除非你数据有问题。

 

 只要合成得phones是这种格式即可 13827126079|13888888888|13812345678

 

 不行就看7楼


 回到顶部
帅哥哟,离线,有人找我吗?
yjd
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:183 积分:1434 威望:0 精华:0 注册:2014/11/7 21:15:00
  发帖心情 Post By:2015/1/12 21:56:00 [只看该作者]

甜版主,您的两个方法我都试了,还是不可以。第一种方法成功一笔,第二种方法系统不响应。我的手机号是绑定表的“手机”列,麻烦您帮帮忙,谢谢!
[此贴子已经被作者于2015-1-12 21:58:10编辑过]

 回到顶部
总数 17 1 2 下一页