I have applied breakpoint and when I click on query
"ResultView" its showing data but when I click 2nd time then data is empty and its showing Enumeration yielded no results
. It is strange, is there any cache issue or something else? Why it is showing empty when I click after 1 time, its just show data 1st time,
var connectionString = String.Format(@"
Provider=Microsoft.ACE.OLEDB.12.0;
Data Source={0};
Extended Properties=""Excel 12.0 Xml;HDR=YES""
", filePath);
//Creating and opening a data connection to the Excel sheet
using (var conn = new OleDbConnection(connectionString))
{
conn.Open();
var cmd = conn.CreateCommand();
cmd.CommandText = "select * from [الحيازات$]";
using (var rdr = cmd.ExecuteReader())
{
//LINQ query - when executed will create anonymous objects for each row
var query =
(from DbDataRecord row in rdr
select row).Select(x =>
{
//dynamic item = new ExpandoObject();
Dictionary<string, string> item = new Dictionary<string, string>();
for (int i = 0; i < x.FieldCount; i++)
{
string data = "" + rdr.GetName(i) + ":{'id':'" + rdr.GetName(i) + "','code':'" + rdr.GetName(i) + "','title':'" + rdr.GetName(i) + "','type':'text','response";
item.Add(data, x[i] + "}");
}
return item;
});
//Generates JSON from the LINQ query
json = JsonConvert.SerializeObject(query, Formatting.Indented).Replace("'", "\"");// break point here