Sending Duplicate sms to same number instead of distinct messages

myth31

New member
Joined
Aug 2, 2011
Messages
1
Programming Experience
1-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 = "[URL]http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to[/URL]=" & var1 & "&msg=" & var2  & "&msg_type=TEXT&userid=XXXXXXXXXauth_scheme=plain&password=XXXXXXX&v=1.1&format=text"
  strResp = DoWebRequest(strUrl)
        Next
End Sub
 
Back
Top