public static void Main1() { serverAnalysis = new Microsoft.AnalysisServices.Server(); try { serverAnalysis.Connect("Data Source = " + strServerName); olap = new Olap(); analysis.Database db = serverAnalysis.Databases.FindByName(strDataBaseName); if (db != null) { db.Drop(); } else { db = serverAnalysis.Databases.Add(strDataBaseName); db.Update(); olap.CreateDataSource(db, strName, strConnectionString); olap.CreateDataSourceView(db, strName, strName); olap.CreateGeographyDimension(db, strName); olap.CreateCustomerDimension(db, strName); olap.CreateCube(db, strName); } } catch (analysis.AmoException ex) { Console.WriteLine(ex.Message); } }