Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i build a simple application for sending message using gsmcomm library and C#. when i sent message through a modem i store it to oracle database SENTMESSAGE table. I provide a table when sending message failed namely FAILEDMESSAGE table (ID, DATE, TIME, PHONENUMBER, MESSAGE), but i still didn't understand how implemented it.

Anyone can suggest me how to differentiate between sending a message succeeded and failed in gsmcomm library?

this is my code for sending a message :
C#
private void btnSentSMS_Click(object sender, EventArgs e)
{
    var msg = txtMessage.Text;
    var phoneNumber = txtNumber.Text;
    var pdu = new SmsSubmitPdu(msg, phoneNumber, string.Empty);
    comm.SendMessage(pdu);
    MessageBox.Show("sms sent");

    //STORE SEND SMS TO DATABASE
    OracleCommand cmd = new OracleCommand();
    cmd.CommandText = @"INSERT INTO SENTMESSAGE (ID, DATE, TIME, PHONENUMBER, MESSAGE) VALUES 
                       (SQ_SENTMESSAGE.NEXTVAL, '" + DateTime.Now + "', TO_DATE('" + DateTime.Now + "', 'dd/MM/yyyy hh24:mi:ss'), '"
                        + phoneNumber + "', '" + msg + "')";
    cmd.Connection = koneksi_manual.con;
    koneksi_manual.con.Open();// <= Open connection before executing the command.
    cmd.ExecuteNonQuery();
    koneksi_manual.con.Close(); //closing connection
}
Posted
Comments
ramyajaya 10-Jun-15 1:15am    
You can get the status report from gsmcomm lib

Hope this helps http://stackoverflow.com/questions/20865424/sms-delivery-report-using-gsmcomm
aminvincent 11-Jun-15 20:56pm    
my problem still didn't solve,...perhaps any idea,..?
Mohammad Reza Valadkhani 11-Jun-15 3:24am    
you can set status method true to check message delivery, also GSMCOMM Provide events for that ( SendFailed Event and SendCompelete Event)
aminvincent 11-Jun-15 20:57pm    
can you give me some examples code ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900