BaseConnectionLibrary 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package BaseConnectionLibrary --version 1.0.1                
NuGet\Install-Package BaseConnectionLibrary -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BaseConnectionLibrary" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BaseConnectionLibrary --version 1.0.1                
#r "nuget: BaseConnectionLibrary, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BaseConnectionLibrary as a Cake Addin
#addin nuget:?package=BaseConnectionLibrary&version=1.0.1

// Install BaseConnectionLibrary as a Cake Tool
#tool nuget:?package=BaseConnectionLibrary&version=1.0.1                

Base connection library (VB.NET/C#)

This repository is for base classes used for connecting to both SQL-Server, MS-Access and Oracle databases using several classes for both easily creating connections along with a generalized method to detect runtime exceptions.

This code may not suit every developer's need and also may seem like overkill to the novice developer. The intent is to have a base class that can be used in any project in one or more Visual Studio solutions. Although the code is VB.NET, the base library can be used with C# also.

Getting started

  • Add the class project KarenBase to your Visual Studio solution, rename the project if so desired.
  • Add a reference to KarenBase to your Windows forms project.
  • Set DatabaseServer to your server e.g. KARENS-PC or for SQL-Server Express .\SQLEXPRESS
  • Set DefaultCatalog to the targeted database in the server above.
  • Follow the example in the project SampleSqlConnection for SQL-Server. MS-Access example to follow.

Test projects

See the following repository which focuses more on using this library with C# but does have a VB.NET project for SQL-Server.

Requires

  • Microsoft Visual Studio 2015 or higher.

Tips

  • IsSuccessFul from the base exception class allow a type to be returned from a function such as a List(Of T) or DataTable without the need to be concerned with if there had been a runtime exception as after the method calls and before using the return item check IsSuccessFul.
Imports SampleSqlConnection.Classes

Public Class Form1
    Private Sub testConnectionButton_Click(sender As Object, e As EventArgs) _
        Handles testConnectionButton.Click

        Dim ops As New DataOperations
        ops.ReadAllCustomersIntoDataTable()

        If ops.IsSuccessFul Then
            ' use the return type
        Else
            ' don't use the return type
        End If
    End Sub
End Class

Simple example for Oracle

Public Class DataOperations
    Inherits OracleConnection

    Public Sub New()
        DataServer = "MyOracleDB"
        UserId = "myUsername"
        Password = "myPassword"
    End Sub
End Class

For a C# version of this library see the following repository.

NuGet package

PM> Install-Package BaseConnectionLibrary -Version 1.0.0

Product Compatible and additional computed target framework versions.
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 2,806 3/22/2019 1.0.3 is deprecated because it is no longer maintained.
1.0.2 641 2/21/2019
1.0.1 767 2/15/2019
1.0.0 691 2/9/2019

Added Oracle connection class