Exemplo n.º 1
0
        /// <summary>
        /// Connect the Microsof SQLServer
        /// </summary>
        /// <param name="cred">Credential to connect</param>
        /// <param name="def">Is connection default?</param>
        /// <param name="dbase">Which database?</param>
        public void Connect(Credential_v2 cred)
        {
            var dataInfo = new DataInfo(
                cred.Host,
                null,
                cred.User,
                cred.GetPasswd(),
                cred.GetProperty("Port"),
                cred.GetProperty("Driver"),
                KCore.C.Database.DBaseType.Hana);

            Connect(dataInfo);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Connect the Microsof SQLServer
        /// </summary>
        /// <param name="cred">Credential to connect</param>
        /// <param name="def">Is connection default?</param>
        /// <param name="dbase">Which database?</param>
        public void Connect(Credential_v2 cred)
        {
            var dataInfo = new DataInfo(
                cred.Host,
                null,
                cred.User,
                cred.GetPasswd(),
                cred.GetProperty("Port").ToInt(),
                cred.GetProperty("Driver").ToString(),
                KCore.C.Database.DBaseType.Hana);

            dataInfo.Default = cred.GetProperty("Default").ToBool();

            //var ConnectionString = new OdbcConnectionStringBuilder(dataInfo.ToConnString());

            Connect(dataInfo);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Set the connection default
        /// </summary>
        /// <param name="cred"></param>
        public static void SetClient(Credential_v2 cred)
        {
            var dbtype = (KCore.C.Database.DBaseType)cred.GetProperty("DBType").ToInt();

            KCore.Base.IBaseClient client;
            switch (dbtype)
            {
            case KCore.C.Database.DBaseType.Hana:
                client = new KCore.DB.Clients.HanaClient(); break;

            case KCore.C.Database.DBaseType.MSQL:
                client = new KCore.DB.Clients.MSQLClient(); break;

            default:
                throw new NotImplementedException();
            }

            client.Connect(cred);

            SetClient(client.GetType());

            client.Dispose();
        }