Connect to your Microsoft SQL server

Open the downloaded project and provide the MS SQL server connection details to 'DatabaseHandling.cs'. These details contain the server name, username, password and database name. These 4 fields are included in the connection string.

setting connection information in databasehandling cs
Figure 1 - Setting connection information in 'DatabaseHandling.cs'

The MS SQL connection string is built up from the provided connection details (Figure 2). The 'serverName' is the domain name or IP address in most cases. Keep in mind that the database user must have rights to use the database.

private static SqlConnection sqlConn = null;
private static string serverName = "(local)\\SQLExpress";
private static string userName = "sqluser";
private static string passwd = "abc123";
private static string database = "ozekisms";
private static string connectionString = "Server=" + serverName +";" +
                "Database=" + database + ";" +
                "User Id=" + userName + ";" +
                "Password=" + passwd + ";";
Figure 2 - Shows how the connection string is built up in 'DatabaseHandling.cs'

Summary

This article explained to your how you can connect to your Microsoft SQL server. Connecting to your Microsoft SQL Server means that you can use the SQL language to control the Ozeki SMS Gateway. This means that all your data will be safely stored and you can easily find any piece of information you are looking for using SQL language. This will make billing or customer complaint handling easier.

Make sure that you don’t stop learning here. Visit the Ozeki website where you can find more information about the system. For example, start with the article about using C# SQL to SMS. The next step is to run an example project.

The next step is to Download the Ozeki SMS Gateway and start developing your own solution.

More information