locked
ASP.NET(DotVVM) can't get data from Azure Table Storage RRS feed

  • Question

  • Hello,

    I have problems reading data from Azure Table Storage in DotVVM web app hosted on Azure. I have confirmed with Storage Explorer that I have data in the table. I can get partition key, row key and timestamp. All other fields(of interest are temperature, humidity and pressure) read 0 when I process data received from query. When I try to filter the data, I am getting exceptions.

    I have tried both commented code and uncommented code, no difference. What could be the cause?

    public class HistoryViewModel : LayoutViewModel
        {
            
            public DateTime DateFrom { get; set; }
            public DateTime DateTo { get; set; }
            public List<MeteoData> Weather { get; set; }
            public override Task Init()
            {
                Weather = new List<MeteoData>();
                return base.Init();
            }
            public void LoadData()
            {
                CloudStorageAccount account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("***********"));
                CloudTableClient client = account.CreateCloudTableClient();
                CloudTable table = client.GetTableReference("WeatherData");
                DateTimeOffset start = new DateTimeOffset(DateFrom, TimeSpan.Zero);
                DateTimeOffset end = new DateTimeOffset(DateTo, TimeSpan.Zero);
                /*var query = from entry in table.CreateQuery<MeteoEntity>()
                                //where entry.TimeStamp > DateFrom
                                //where entry.TimeStamp < DateTo
                                //where entry.Humidity == 0
                            select entry;*/
                TableQuery<MeteoEntity> query = new TableQuery<MeteoEntity>()
                    .Where(TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.GreaterThanOrEqual, start));
                    //.Where(TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.LessThanOrEqual, end));
                Weather.Clear();
                foreach(var entity in table.ExecuteQuery(query))
                {
                    Weather.Add(new MeteoData()
                    {
                        TimeStamp = entity.TimeStamp,
                        Temperature = entity.Temperature,
                        Humidity = entity.Humidity,
                        Pressure = entity.Pressure
                    });
                }
            }
        }
        public class MeteoData
        {
            public DateTime TimeStamp { get; set; }
            public float Temperature { get; set; }
            public float Humidity { get; set; }
            public float Pressure { get; set; }
        }
        public class MeteoEntity : TableEntity
        {
            public int Room { get; set; }
            public DateTime TimeStamp { get; set; }
            public float Temperature { get; set; }
            public float Humidity { get; set; }
            public float Pressure { get; set; }
        }

    Friday, September 15, 2017 7:58 AM

All replies

  • Create a Technical Support Ticket as our engineers would need to work with you on the issue and would require more details on the issue to find the root cause of the issue.

    ------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Wednesday, September 20, 2017 7:32 PM
  • Thanks for answer. However this is just an experiment for me. I am not willing to pay this amount each month.
    Sunday, September 24, 2017 7:30 AM