TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Javier Rodzs
NA
8
3.9k
cannot convert from 'string' to 'System.Collections.Generic.IEnumerabl
Dec 17 2020 12:08 PM
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);
/*******************************************************
connection
*******************************************************/
adomdConnection.Open();
AdomdDataReader reader = adomdCommand.ExecuteReader();
// Create a loop for every row in the resultset
while
(reader.Read())
{
String rowResults =
""
;
// Create a loop for every column in the current row --need to add header
for
(
int
columnNumber = 0;
columnNumber<reader.FieldCount;
columnNumber++
)
{
rowResults += $
"\t{reader.GetValue(columnNumber)}"
;
}
//Console.WriteLine(rowResults);
File.WriteAllText(@
"C:\Temp\output.txt"
, rowResults) ;
//File.WriteAllLines(@"C:\Temp\output.txt", rowResults) ;
//
//string rowResults1 = (rowResults);
//var query1 = rowResults1;
//File.WriteAllLines(@"C:\Temp\output.txt", query1);
//
}
adomdConnection.Close();
}
}
}
Reply
Answers (
1
)
Block clicks with mouse on the form
Hello, do you know if it is a problem to create a build configuration