/* * Create mining structure based on selection */ public string CreateMiningStructure(List <string> inputColumns, List <string> predictColumns, string sAlgorithm, string sTableName, string sKeyColumn, string sStructureName, List <bool> lbPredictItems, int parOne, int parTwo) { try { // Connect to the Analysis Service server Database currentDB = GetCurrentDatabase(sCatalog); // create a new mining structure MiningStructure currentStructure = CreateCustomMiningStructure(currentDB, sStructureName, sTableName, sKeyColumn, inputColumns, predictColumns, sAlgorithm, lbPredictItems); // create a mining model for the selected structure CreateCustomModel(currentStructure, sAlgorithm, sStructureName, sKeyColumn, predictColumns, lbPredictItems, parOne, parTwo); // Process Database and structure currentStructure.Process(); return("Success"); } catch (Exception e) { return(e.Message); } }
public bool CreateMiningStructureIfCan() { try { // init server connection Server svr = new Server(); svr.Connect("integrated security=SSPI;data source=" + sServer + ";persist security info=False;initial catalog=" + sCatalog); // Connect to the Analysis Service server Database currentDB = GetCurrentDatabase(sCatalog); currentDB.Refresh(); // if current database doesn't exist, then create it //if (currentDB == null) // CreateNewDatabase(); // create a new mining structure MiningStructure currentStructure = CreateMiningStructure(currentDB); currentStructure.Refresh(); // create a mining model for the selected structure CreateModels(currentStructure); // Process Database and structure currentStructure.Process(); //ProcessDatabase(myDB); return(true); } catch (Exception e) { Console.WriteLine(e.StackTrace); SMiningError = e.StackTrace; } return(false); }