将重复的短信发送到相同的号码,而不是不同的消息 [英] Sending Duplicate sms to same number instead of distinct messages
本文介绍了将重复的短信发送到相同的号码,而不是不同的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试向数据库中的不同用户发送短信.代码在本地主机上运行良好.但是,当我将其上传到服务器时,它可以工作,但是它正在发送重复的消息.也就是说,如果有3条消息要发送给3个不同的人,则每个人都会收到两次或三次而不是一次的消息.这是我使用的代码.请帮忙
I am trying to send sms to distinct users from the database. Code works perfectly fine on the local host. But when I upload it to the server, it works but it is sending duplicate messages. That is if there are 3 messages to 3 different people, each person gets his message twice or thrice instead of once. This is the code I have used. Please help
Public Function DoWebRequest(ByVal url) As String
On Error GoTo err_DoWebRequest
Dim objXML As Object
objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open("GET", url, False)
objXML.Send()
If (objXML.Status = 404) Then
DoWebRequest = "404 Error"
Else
DoWebRequest = objXML.ResponseText
End If
objXML = Nothing
Exit Function
err_DoWebRequest:
DoWebRequest = "ERROR"
Exit Function
End Function
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strUrl As String
Dim strResp As String
Dim var1 As String
Dim var2 As String
Dim cnn As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
Dim da As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM crm", cnn)
Dim ds As New System.Data.DataSet()
da.Fill(ds, "crm")
Dim dr As System.Data.DataRow
For Each dr In ds.Tables("crm").Rows
var1 = dr("Mobile").ToString()
var2 = dr("MsgCode").ToString()
strUrl = "http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to=" & var1 & "&msg=" & var2 & "&msg_type=TEXT&userid=XXXXXXXXXauth_scheme=plain&password=XXXXXXX&v=1.1&format=text"
strResp = DoWebRequest(strUrl)
Next
End Sub
推荐答案
如果您在服务器上使用其他数据库,则可能是您的服务器数据库在同一移动电话号码中有多行.检查服务器中crm表的行.
If you are using a different database on your server, it may be that your server database has more than one row for the same mobile number. Check the rows of the crm table in your server.
这篇关于将重复的短信发送到相同的号码,而不是不同的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文