Avrora.Db.MSSQLConnection 1.0.3

MSSQL Connection Class

Install-Package Avrora.Db.MSSQLConnection -Version 1.0.3
dotnet add package Avrora.Db.MSSQLConnection --version 1.0.3
<PackageReference Include="Avrora.Db.MSSQLConnection" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Avrora.Db.MSSQLConnection --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

class DBTest
{
private SqlDBConnect con;
internal DBHandler() {
SqlConnParams connParams = new SqlConnParams()
.ServerIP("server ip address")
.DatabaseName("database name")
.UserId("user id")
.Password("password")
.TrustedConnection(false)
.ConnectionTimeout(60);
con = SqlDBConnect.GetConnection(connParams);
}

    internal DataTable GetDataTableTest(string someId)
    {
        try
        {

            SqlParameter[] p = {
                con.SetParameter("some_param_id", SqlDbType.VarChar, 10, ParameterDirection.Input, someId)
            };
            return con.GetDataTable("select * from test_table where test_id = @some_param_id", p);
        }
        catch (Exception e) {
			return null;
        }
    }

    internal DataTable GetDataTableWithoutParamTest()
    {
        try
        {
			return con.GetDataTable("select * from test_table");
        }
        catch (Exception e)
        {
			return null;
        }
    }
	
	internal void TestExecuteSQL(){
		SqlDataReader dr =  con.ExecuteSQL("select * from test_table");
		while(dr.read()){
			string val = dr["test_column_name"].toString();
		}
		dr.Close();
	}

}

class DBTest
{
private SqlDBConnect con;
internal DBHandler() {
SqlConnParams connParams = new SqlConnParams()
.ServerIP("server ip address")
.DatabaseName("database name")
.UserId("user id")
.Password("password")
.TrustedConnection(false)
.ConnectionTimeout(60);
con = SqlDBConnect.GetConnection(connParams);
}

    internal DataTable GetDataTableTest(string someId)
    {
        try
        {

            SqlParameter[] p = {
                con.SetParameter("some_param_id", SqlDbType.VarChar, 10, ParameterDirection.Input, someId)
            };
            return con.GetDataTable("select * from test_table where test_id = @some_param_id", p);
        }
        catch (Exception e) {
			return null;
        }
    }

    internal DataTable GetDataTableWithoutParamTest()
    {
        try
        {
			return con.GetDataTable("select * from test_table");
        }
        catch (Exception e)
        {
			return null;
        }
    }
	
	internal void TestExecuteSQL(){
		SqlDataReader dr =  con.ExecuteSQL("select * from test_table");
		while(dr.read()){
			string val = dr["test_column_name"].toString();
		}
		dr.Close();
	}

}

Dependencies

This package has 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 History

Version Downloads Last updated
1.0.3 470 4/16/2018