Can we use MySQL with Xamarin Forms Tizen TV App ? I am getting exception on connection.Open() line

45 views Asked by At

I am unable to debug it also.

connection.Open() Here i am getting exception while running from Tizen Emulator.

GetMySqlConnection() will return the mysqlconnector instance.

 public async Task<List<SensorData1>> GetAllSensorData()
    {
        var connection = GetMySqlConnection();
        List<SensorData1> sensorDataList = new List<SensorData1>();
        try
        {
            if (connection != null)
            {
                connection.Open(); 
                var command = new MySqlCommand("SELECT * FROM SensorData1;", connection);

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        sensorDataList.Add(new SensorData1()
                        {
                            AQI = reader["AQI"].ToString(),
                            PM2_5 = reader["PM2_5"].ToString(),
                            PM10 = reader["PM10"].ToString(),
                            Client_ID = reader["Client_ID"].ToString(),
                            Device_ID = reader["Device_ID"].ToString()
                        });
                    }
                }
            }

        }
        catch (Exception ex)
        {

            //throw;
        }
        finally
        {
            if (connection != null)
            {
                connection.Close();
            }
        }
        return sensorDataList;
    }
0

There are 0 answers