i m using this to send sms using mCore ActiveX Component in vb6 this code is working fine but sometime send a single sms with multiple times infact hunderds time until i close my application.please guide me i m much familiar with vb6
Public Function SendSMS()
On Error Resume Next
Dim strSendResult As String
Dim ij As Integer
Dim message As String, blnAllMsgsSent As Boolean
Dim message1,
Dim id As Integer
blnAllMsgsSent = True
If objSMS.Connect Then
Timer2.Enabled = False
ij = 0
SQL = "SELECT id,message,MobileNo FROM tblSendSMS where status='Pending' order by id asc;"
RS.Open SQL, Conn, adOpenDynamic
If Not RS.EOF Then
RS.MoveFirst
Do While Not RS.EOF
message = RS!message
If RS!message <> "" Then
id = RS!id
'' send message now
strSendResult = objSMS.SendSMS(MobileNo, message)
strSendResult = ""
If objSMS.IsError(True, "Application.exe") Then
blnAllMsgsSent = False
End If
End If
If blnAllMsgsSent Then
SQL = "update tblSendSMS set status='Sent' where id=" & id
Conn.Execute SQL
End If
'' end send
End If
ij = ij + 1
RS.MoveNext
Loop
End If
RS.Close
Else
SetCommParameters
End If
Timer2.Enabled = True
End Function
Public Function SendSMS()
On Error Resume Next
Dim strSendResult As String
Dim ij As Integer
Dim message As String, blnAllMsgsSent As Boolean
Dim message1,
Dim id As Integer
blnAllMsgsSent = True
If objSMS.Connect Then
Timer2.Enabled = False
ij = 0
SQL = "SELECT id,message,MobileNo FROM tblSendSMS where status='Pending' order by id asc;"
RS.Open SQL, Conn, adOpenDynamic
If Not RS.EOF Then
RS.MoveFirst
Do While Not RS.EOF
message = RS!message
If RS!message <> "" Then
id = RS!id
'' send message now
strSendResult = objSMS.SendSMS(MobileNo, message)
strSendResult = ""
If objSMS.IsError(True, "Application.exe") Then
blnAllMsgsSent = False
End If
End If
If blnAllMsgsSent Then
SQL = "update tblSendSMS set status='Sent' where id=" & id
Conn.Execute SQL
End If
'' end send
End If
ij = ij + 1
RS.MoveNext
Loop
End If
RS.Close
Else
SetCommParameters
End If
Timer2.Enabled = True
End Function