private Task <bool> checkConnections(string conLink) { TaskCompletionSource <bool> taskCompletionSource = new TaskCompletionSource <bool>(); Task.Run(() => { dbServer dbServer = new dbServer(conLink); bool conn = dbServer.checkConnectionSync(); taskCompletionSource.SetResult(conn); }); return(taskCompletionSource.Task); }
private void btnDeploydb_Click(object sender, EventArgs e) { //btnFindConn.PerformClick(); if (islinkFound) { dbServer dbServer = new dbServer(txtConnectingString.Text); dbServer.executeStoreProcedure(GetDbCreationQuery()); string dbName = Path.GetFileNameWithoutExtension(txtSQLtxtFile.Text); string[] conParts = txtConnectingString.Text.Split(';'); string connLink = ""; foreach (var part in conParts) { if (part.Contains("Initial")) { connLink += "Initial Catalog=" + dbName; } else { connLink += part; } connLink += ";"; } dbServer = new dbServer(connLink); string[] data = File.ReadAllLines(txtSQLtxtFile.Text); List <string> quries = sysController.getQueriesFromSQLFile(data); foreach (string command in quries) { dbServer.executeStoreProcedure(command); } Clipboard.SetText(connLink); MessageBox.Show("Database Succesfully Deployed! \n And Connection String copied to Clipboard"); } else { MessageBox.Show("Link not Found! Please wait until Possible link to database in found!"); btnFindConn.PerformClick(); } }