GMSLibDataAccessSQL

Library to help using connections and querys to MSSQLServer, SQLite and MSAccess


Keywords
SQL, connection, helper, query, lib, data, database, db
Install
Install-Package GMSLibDataAccessSQL -Version 1.0.7

Documentation

Introduction

Library to help using connections and querys to MSSQLServer, SQLite and MSAccess. With this lib, you will focus your efforts in create the application and ignore the connection and methods to access the database.

Getting Started

Contribute

TODO: Explain how other users and developers can contribute to make your code better.

If you want to learn more about creating good readme files then refer the following guidelines. You can also seek inspiration from the below readme files:

ChangeLog

  • 1.0.7 - 2019/09/06:

Unit Test de errores de los metodos de SQLserver.

Error unit test of SQLserver methods.

  • 1.0.6 - 2019/09/04:

Unit Test de los metodos de SQLserver y mejorar las funciones SQLserver cuando se generan timeouts.

Unit Test of SQLserver methods and improve the SQLServer timeout methods.


  • 1.0.5 - 2019/08/25:

Evitar el uso de slow-cheetah por los problemas que está causando la version 3.2.20

Avoid using slow-cheetah due to the error on transformation in version 3.2.20


  • 1.0.0.4 - 2019/08/18:

Mejora de las reconexiones y creados los métodos de creación de una base de datos access.

Reconnection improvements and MSAccess database creation methods.


Basis

SQLite management

Introduction

SQLite is a portable database, very usefull when you have limited resources and installation permissions.

Instance

The best way to use the capabilities is with the interface layer: IGmsLibDataAccess objDataBaseAccess and then using the class constructor: new GmsLibDataAcessSqlite(StrConnectionString, out result);

Using the interface will be very helpfull if you plan to migrate the SQLite database to and SQLServer database. You will only need to change the class constructor name.

Public methods

Constructors:

  • public GmsLibDataAcessSqlite(string strConnectionStringBd, out bool result): With the connection string the method will check if the database exists and create it. It will use the default connection parameters to configure the object:
    • Max connection retries = 3
    • Wait seconds between reconnections = 10
    • Max execution retries = 10
    • Wait seconds between executions = 6
  • public GmsLibDataAcessSqlite(string connectionString, int numMaxReconnections, int numSecondsBetweenReconnection , int maxExecutionRetries, int numSecondsBetweenExecutionRetries, out bool bolFnResult): With the connection string the method will check if the database exists and create it. It will use the received connection parameters to configure the object.

Examples:

string strSQLConnection = "data source=#DIRECTORY##DATABASE#.#EXTENSION#;Compress=True;synchronous=Off;foreign keys=True;pooling=True;Journal Mode=Wal;Default Isolation Level=ReadCommitted";

  • #DIRECTORY# is the fullpath to the database that you want
  • #DATABASE# is the name of the database.
  • #EXTENSION# is a extension to the sqlite database. For example db, sqlite, sqlite2 or sqlite3, but any other extension will work.

var sqliteconnect = new GmsLibDataAcessSqlite(strSQLConnection, out result) Console.WriteLine(sqliteconnect.GetError);

var sqliteconnect = new GmsLibDataAcessSqlite(strSQLConnection, 10, 5, 3, 1, out result) Console.WriteLine(sqliteconnect.GetError);

Connections:

  • public bool OpenSqlConnection(): This method will open the connection and leave it open until the object is dispose or close it with the CloseSqlConnection()
  • public bool CloseSqlConnection(): This method will close the previously opened connection.

Both methods will return a true or false with the result of the method. If false is return, please, check the object.GetError to know the error message.

SQLServer management

MSAccess management