static async Task DoIt() { var netCoreVer = System.Environment.Version; // 3.0.0 AceQLConsole.WriteLine(netCoreVer + ""); string connectionString = ConnectionStringCurrent.Build(); using (AceQLConnection connection = new AceQLConnection(connectionString)) { connection.RequestRetry = true; connection.AddRequestHeader("aceqlHeader1", "myAceQLHeader1"); connection.AddRequestHeader("aceqlHeader2", "myAceQLHeader2"); await connection.OpenAsync(); if (DO_LOOP) { while (true) { await ExecuteExample(connection).ConfigureAwait(false); Thread.Sleep(1000); } } else { await ExecuteExample(connection).ConfigureAwait(false); } await connection.CloseAsync(); } }
/// <summary> /// Does it. /// </summary> /// <param name="args">The arguments.</param> /// <returns></returns> public static async Task DoIt(string[] args) { try { // Make sure connection is always closed in order to close and release // server connection into the pool using (AceQLConnection theConnection = await ConnectionBuilderAsync()) { MySqlStoredProcedureTest myRemoteConnection = new MySqlStoredProcedureTest( theConnection); AceQLConsole.WriteLine("Connection created...."); await myRemoteConnection.CallStoredProcedure().ConfigureAwait(false); await theConnection.CloseAsync(); AceQLConsole.WriteLine("The end..."); } AceQLConsole.WriteLine(); AceQLConsole.WriteLine("Press enter to close...."); Console.ReadLine(); } catch (Exception exception) { AceQLConsole.WriteLine(exception.ToString()); AceQLConsole.WriteLine(exception.StackTrace); AceQLConsole.WriteLine("Press enter to close..."); Console.ReadLine(); } }
static async Task DoIt(string[] args) { AceQLConsole.WriteLine("Building connection with credential..."); AceQLConnection connection = await ConnectionBuilderAsyncWithCredential().ConfigureAwait(false); WebDocSample webDocSamples = new WebDocSample(connection); await webDocSamples.DeleteCustomers().ConfigureAwait(false); AceQLConsole.WriteLine("Insert customer..."); await webDocSamples.InsertCustomer().ConfigureAwait(false); AceQLConsole.WriteLine("display customer 1..."); await webDocSamples.SelectCustomerOne().ConfigureAwait(false); AceQLConsole.WriteLine(); AceQLConsole.WriteLine("update customer..."); await webDocSamples.UpdateCustomer().ConfigureAwait(false); AceQLConsole.WriteLine(); AceQLConsole.WriteLine("display customer..."); await webDocSamples.SelectCustomer().ConfigureAwait(false); AceQLConsole.WriteLine(); await webDocSamples.DeleteCustomers().ConfigureAwait(false); await webDocSamples.DeleteOrderlogs().ConfigureAwait(false); await webDocSamples.InsertCustomerAndOrderLogAsync(1, 1).ConfigureAwait(false); AceQLConsole.WriteLine(); await webDocSamples.DeleteOrderlogs().ConfigureAwait(false); AceQLConsole.WriteLine(); AceQLConsole.WriteLine("Insert BLOB..."); await webDocSamples.InsertBlob(1, 1).ConfigureAwait(false); AceQLConsole.WriteLine("Select BLOB..."); await webDocSamples.SelectBlob(1, 1).ConfigureAwait(false); await webDocSamples.DeleteOrderlogs(); AceQLConsole.WriteLine(); AceQLConsole.WriteLine("Insert BLOB with ProgressIndicator..."); await webDocSamples.InsertBlobProgressIndicator(1, 1).ConfigureAwait(false); AceQLConsole.WriteLine(); AceQLConsole.WriteLine("Select BLOB..."); await webDocSamples.SelectBlob(1, 1).ConfigureAwait(false); await connection.CloseAsync(); AceQLConsole.WriteLine("Connection closed."); }
static async Task DoIt() { string connectionString = ConnectionStringCurrent.Build(); // Make sure connection is always closed to close and release server connection into the pool using (AceQLConnection connection = new AceQLConnection(connectionString)) { await ExecuteExample(connection).ConfigureAwait(false); await connection.CloseAsync(); } }
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); } }
static async Task DoIt() { var netCoreVer = System.Environment.Version; // 3.0.0 AceQLConsole.WriteLine(netCoreVer + ""); string connectionString = ConnectionStringCurrent.Build(); using (AceQLConnection connection = new AceQLConnection(connectionString)) { await ExecuteExample(connection).ConfigureAwait(false); await connection.CloseAsync(); } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { try { if (connection != null) { connection.CloseAsync(); } } catch (Exception) { // Don't care } this.Hide(); Application.Exit(); }
public static async Task UseConnection() { string connectionString = null; AceQLConnection connection = null; try { connection = new AceQLConnection(connectionString); await connection.OpenAsync(); // SQL stuff... } finally { await connection.CloseAsync(); } }
static async Task DoIt() { string serverUrlLocalhost = "http://localhost:9090/aceql"; string server = serverUrlLocalhost; string database = "sampledb"; string username = "******"; string sessionId = "4pdh8p2t14nd6j7dxt1owyjxef"; string connectionString = $"Server={server}; Database={database}"; Boolean doItWithCredential = true; if (!doItWithCredential) { connectionString += $"; Username={username}; SessionId={sessionId}"; AceQLConsole.WriteLine("Using connectionString with SessionId: " + connectionString); // Make sure connection is always closed to close and release server connection into the pool using (AceQLConnection connection = new AceQLConnection(connectionString)) { await connection.OpenAsync(); await AceQLTest.ExecuteExample(connection).ConfigureAwait(false); await connection.CloseAsync(); } } else { AceQLConsole.WriteLine("Using AceQLCredential with SessionId: " + sessionId); AceQLCredential credential = new AceQLCredential(username, sessionId); // Make sure connection is always closed to close and release server connection into the pool using (AceQLConnection connection = new AceQLConnection(connectionString)) { connection.Credential = credential; await connection.OpenAsync(); await AceQLTest.ExecuteExample(connection).ConfigureAwait(false); await connection.CloseAsync(); } } }
/// <summary> /// Does it. /// </summary> /// <param name="args">The arguments.</param> /// <returns></returns> public static async Task DoIt(string[] args) { try { int customerId = 1; int itemId = 1; // Make sure connection is always closed in order to close and release // server connection into the pool using (AceQLConnection connection = await ConnectionBuilderAsync()) { MyRemoteConnection myRemoteConnection = new MyRemoteConnection( connection); // Delete previous instances, so that user can recall AceQLConsole.WriteLine("deleting customer..."); await myRemoteConnection.DeleteCustomerAsync(customerId).ConfigureAwait(false);; AceQLConsole.WriteLine("deleting orderlog..."); await myRemoteConnection.DeleteOrderlogAsync(customerId, itemId).ConfigureAwait(false);; await myRemoteConnection.InsertCustomerAndOrderLogAsync(customerId, itemId).ConfigureAwait(false);; await myRemoteConnection.SelectCustomerAndOrderLogAsync(customerId).ConfigureAwait(false);; await connection.CloseAsync().ConfigureAwait(false);; AceQLConsole.WriteLine("The end..."); } AceQLConsole.WriteLine(); AceQLConsole.WriteLine("Press enter to close...."); Console.ReadLine(); } catch (Exception exception) { AceQLConsole.WriteLine(exception.ToString()); AceQLConsole.WriteLine(exception.StackTrace); AceQLConsole.WriteLine("Press enter to close..."); Console.ReadLine(); } }
static async Task DoIt(string[] args) { #pragma warning disable CS0219 // Variable is assigned but its value is never used string serverUrlLocalhost = "http://localhost:9090/aceql"; #pragma warning disable CS0219 // Variable is assigned but its value is never used string serverUrlLocalhostTomcat = "http://localhost:8080/aceql-test/aceql"; #pragma warning restore CS0219 // Variable is assigned but its value is never used #pragma warning disable CS0219 // Variable is assigned but its value is never used string serverUrlLinux = "https://www.aceql.com:9443/aceql"; #pragma warning restore CS0219 // Variable is assigned but its value is never used string server = serverUrlLinux; string database = "sampledb"; 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), //zipcode character(10) NOT NULL, //phone character varying(32), string connectionString = $"Server={server}; Database={database}; "; //connectionString += $"Username={username}; Password={password}"; 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.Credential = credential; await ExecuteExample(connection).ConfigureAwait(false); await connection.CloseAsync(); } }