private static void ExecuteCommand(string commandText, string connectionString /*, IBindingContext context, string actionName*/) { { try { AdomdConnection conn = AdomdConnectionPool.GetConnection(connectionString); using (AdomdCommand cmd = new AdomdCommand(commandText, conn)) { cmd.Execute(); } } catch { } finally { } } }
internal static String UpdateSync(String updeteScript, UpdateCubeArgs args) { String result = String.Empty; string cubeName = args.CubeName; string connectionString = args.ConnectionString; string commandText = string.Empty; if (string.IsNullOrEmpty(updeteScript)) { commandText = string.Format(UPDATE_COMMAND_TEMPLATE, args.CubeName); } List <string> commands = new List <string>(); for (int i = 0; i < args.Entries.Count; i++) { UpdateEntry entry = args.Entries[i]; StringBuilder sb = new StringBuilder(); foreach (ShortMemberInfo mi in entry.Tuple) { if (sb.Length > 0) { sb.Append(','); } sb.Append(mi.UniqueName); } string tuple = sb.ToString(); sb = null; string lexeme = Environment.NewLine; if (i > 0) { if (string.IsNullOrEmpty(updeteScript)) { lexeme += ','; } } if (string.IsNullOrEmpty(updeteScript)) { lexeme += string.Format("({0}) = {1}", tuple, entry.NewValue); commandText += lexeme; } else { string cmd = updeteScript; ParseHierarchies(ref cmd, entry.Tuple, entry.NewValue, entry.OldValue); lexeme += cmd; commands.Add(lexeme); } } if (string.IsNullOrEmpty(updeteScript)) { commands.Add(commandText); } try { try { //bool error = false; foreach (string cmdText in commands) { try { AdomdConnection conn = AdomdConnectionPool.GetConnection(connectionString); { using (AdomdCommand cmd = new AdomdCommand(cmdText, conn)) { result = cmdText; cmd.ExecuteNonQuery(); } } } catch (Exception exc) { //error = true; throw exc; } } } finally { } } catch (Exception exc) { throw exc; } return(result); }