Send SMS From VB.NET using Database

If you are creating a VB.NET application, you can expand the functionalities with an SMS sending option. To do that, we provide you this step-by-step tutorial, which will guide you through the process of downloading an example project, creating a database layout and a database user, modifying the source code and testing out the example application. The source code is provided, feel free to edit it.

How to send SMS from VB.NET using Database (Easy directives)

To send SMS from VB.NET using Database:

  1. Setup Microsoft Visual Studio
  2. Install Microsoft SQL Express
  3. Download the example project
  4. Open OzekiSmsDBInsert.sln
  5. Create database tables
  6. Launch Ozeki SMS Gateway
  7. Add Database user
  8. Modify the Database connection tab
  9. Edit the source code in Visual Studio
  10. Send test SMS from VB.NET

Step 1 - Download an example project

To download an example project which you can work with, please head over here, and click the download link on the top of the page as you can see in Figure 1. You will have to wait out, until your browser downloads all the necessary files for you.

download the example project
Figure 1 - Download example project

Step 2 - Open the example project

If you successfully downloaded the files, please open the Visual Studio Solution file, called “OzekiSmsDBInsert.sln”. You will need Microsoft Visual Studio to open and edit the example project. You can find it easily with the help of Figure 2.

open the project file
Figure 2 - Open the project file

Step 3 - Connect the database with the user in Ozeki SMS Gateway

Next up, you need to create the database tables on your Microsoft SQL Express database server by copy-pasting the following code:

create database ozeki
GO

use ozeki
GO

CREATE TABLE ozekimessagein (
 id int IDENTITY (1,1),
 sender varchar(30),
 receiver varchar(30),
 msg varchar(160),
 senttime varchar(100),
 receivedtime varchar(100),
 operator varchar(30),
 msgtype varchar(30),
 reference varchar(30),
);

CREATE TABLE ozekimessageout (
 id int IDENTITY (1,1),
 sender varchar(30),
 receiver varchar(30),
 msg varchar(160),
 senttime varchar(100),
 receivedtime varchar(100),
 operator varchar(100),
 msgtype varchar(30),
 reference varchar(30),
 status varchar(30),
 errormsg varchar(250)
);
GO
    
sp_addLogin 'ozekiuser', 'ozekipass'
GO
  
sp_addsrvrolemember 'ozekiuser', 'sysadmin'
GO

You can see the copied code on Figure 3.

create the database layout in mssql server
Figure 3 - Create the database layout in MSSQL Server

The next step is to create a database user in Ozeki SMS Gateway. To do that, please use the Ozeki SMS Gateway’s “Add user or application” panel. You need to choose the “Database” option in order to create a connection with your MSSQL database server, as demonstrated on Figure 4.

create database user in ozeki sms gateway
Figure 4 - Create database user in Ozeki SMS Gateway -

To connect your database server to the user in Ozeki SMS Gateway, you need to modify the “Database connection” tab in the Ozeki SMS Gateway. You will need to copy-paste your own server properties to work and click "OK". On Figure 5, we used our test server properties.

connect to the database
Figure 5 - Connect to the database

To modify the login credentials, you will need to edit the source code, with Microsoft Visual Studio, as seen below on Figure 6.

modify the login credentials in the source code
Figure 6 - Modify the login credentials in the source code

Step 4 - Start the program

If you have done all the steps correctly, you have a working system. To start the program, click the “Start” button on the top of the Microsoft Visual Studio window as it is presented on Figure 7.

start the project
Figure 7 - Start the project

If the program started, you will be presented with the GUI of the example project, as it is on Figure 8.

send the test sms
Figure 8 - Send the Test SMS

To sum it up

This article showed you how you can expand the functionalities of your VB.NET application with an SMS sending option. This solution provides a high-performance, easy-to-use system for message sending with the VB.NET application and the Ozeki SMS Gateway. If you have followed the guide through the process of downloading an example project, creating a database user, modifying the source code, and testing out the example application then you are able to set up this system.

There is more valuable information for you to acquire, you can find them here on the Ozeki website. Jump into another interesting article to learn about how to send SMS from VB.NET using HTTP API.

Download the Ozeki SMS Gateway now for endless possibilities!