Dear reader, today we will discuss a very important topic, sending SMS alerts to a mobile phone that is a common demand of most clients. I have experience developing donation collection software. In that software we used a GSM Modem to send a SMS thanks to the donor. So we developed a small application that runs on the server and sends a SMS whenever a new record is inserted into the database from any client.In this application we will use the following:

Now you can insert any record in the table but please make sure to insert:

[Don_Donor_ID]= CF-00001-12 and leave the [Don_SMS1], [Don_SMS2] field NULL, [Don_Mobile_Phone] please enter valid phone number where you want to recive the sms.

Step 3

Create the new Desktop application.

Step 4

Design the form as shown in the picture.

Step 5

Dear Reader, please read this carefully in thais step we need to include the following DLL files in the bin\ Debug folder:

GSMCommServer.dll

GSMCommShared.dll

GSMCommunication.dll

PDUConverter.dll

Step 6

Now we need to add the reference to the project as shown in the picture.

Step 7

Now we have added one more reference.

Step 8

Now we need to move to the code behind window and use these references in the code.

Step 9

Now we need to add few textboxes and private variables that we will use in our code.

Step 10

Now we will add the two classes Operation and Main as in the following and add two methods in it GetDBConnection, ipconfig and Execute.

Step 11

Now add the following code in the form load event.

Step 12

Now add the following code in the connect button click event.

Step 13

Now add the following code in the send button click event.

Note: Dear reader please doesn't worry, I have attached the source file for your reference. No need to type in the entire code. But you need to change the SQL Server setting correspondingly for your own system.For example:

Now we need to attach the modem to the system. It will install its own application but keep this point in your mind, you need to close the application after the installation is complete because that software captures the port that we will use in our code.

Picture 1

Picture 2 (let this application to be installed and close it when it is finished).

Step 15

Now run the application; press F5.

First we need to select the port name from the drop down menu then press the connect button; if port is not valid then it will show the error message.

Now I will select port COM4; it will connect successfully. Dear reader, you need to check your port one by one; Windows XP normally uses port COM3 or COM4.

Step 16

Now press the "Send SMS button"; you will then get a SMS on your mobile phone as in the following:

NOTE: Dear reader, the code works 100%; please contact me if you have any query regrarding this article.

I have been working as a Senior Software Engineer and database developer since 2003 for an MNC. I visit many websites, daily to update myself. Now I want to share my knowledge with others to improve myself. I'... Read more