Im trying to export results to a txt file, I need to include all rows and columns. In my query below I can see in the console all the rows and columns, when I use "File.WriteAllText", it only write one row with all columns, when I try to use "File.WriteAllLines" i receive the error msg "cannot convert from 'string' to 'System.Collections.Generic.IEnumerable" . any help really appreciated
- using System;
- using Microsoft.AnalysisServices.AdomdClient;
- using System.IO;
- using System.Diagnostics;
- using System.Text;
- using System.Collections.Generic;
- using System.Linq;
- namespace DaxQuery
- {
- class Program
- {
- private const string V = "";
- static void Main(string[] args)
- {
- AdomdConnection adomdConnection = new AdomdConnection("Data Source=localhost:60100");
- String query = @"
- EVALUATE
- SUMMARIZECOLUMNS(
- Customer[City],
- Customer[Country-Region],
- Customer[Customer],
- Customer[Customer ID]
- )
- ";
- AdomdCommand adomdCommand = new AdomdCommand(query,adomdConnection);
-
-
-
- adomdConnection.Open();
- AdomdDataReader reader = adomdCommand.ExecuteReader();
-
- while(reader.Read())
- {
- String rowResults = "";
-
- for (
- int columnNumber = 0;
- columnNumber<reader.FieldCount;
- columnNumber++
- )
- {
- rowResults += $"\t{reader.GetValue(columnNumber)}";
- }
-
- File.WriteAllText(@"C:\Temp\output.txt", rowResults) ;
-
-
-
-
-
-
- }
- adomdConnection.Close();
- }
- }
- }