Beispiel #1
0
        static async Task DoIt(string[] args)
        {
            string username = "******";
            string password = "******";

            //customer_id integer NOT NULL,
            //customer_title character(4),
            //fname character varying(32),
            //lname character varying(32) NOT NULL,
            //addressline character varying(64),
            //town character varying(32),
            //zipscode character(10) NOT NULL,
            //phone character varying(32),

            string connectionString = null;
            bool   useProxy         = false;

            if (useProxy)
            {
                string proxyUsername = "******";
                string proxyPassword = "";
                connectionString = $"Server={server}; Database={database}; ProxyUsername={proxyUsername}; ProxyPassword= {proxyPassword}";
            }
            else
            {
                connectionString = $"Server={server}; Database={database}";
            }

            AceQLCredential credential = new AceQLCredential(username, password.ToCharArray());

            // Make sure connection is always closed to close and release server connection into the pool
            using (AceQLConnection connection = new AceQLConnection(connectionString))
            {
                //connection.SetTraceOn(true);

                connection.Credential = credential;
                await ExecuteExample(connection).ConfigureAwait(false);

                await connection.CloseAsync();

                AceQLConnection connection2 = new AceQLConnection(connectionString)
                {
                    Credential = credential
                };

                await connection2.OpenAsync();

                AceQLConsole.WriteLine("connection2.GetServerVersion(): " + await connection2.GetServerVersionAsync());

                await connection2.LogoutAsync().ConfigureAwait(false);
            }
        }