How can I fetch data to dynamic List of Table in Maui from Sqlite Database?

145 Views Asked by At

I want to fetch data from SQLite database in Maui using raw Query. But while trying this function I am getting error:

>{System.ArgumentNullException: Value cannot be null. (Parameter 'type')
   at System.ArgumentNullException.Throw(String paramName)
   at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)
   at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)
   at SQLite.TableMapping.GetPublicMembers(Type type)
   at SQLite.TableMapping..ctor(Type type, CreateFlags createFlags)
   at SQLite.SQLiteConnection.GetMapping(Type type, CreateFlags createFlags)
   at SQLite.SQLiteCommand.ExecuteQuery[Object]()
   at SQLite.SQLiteConnection.Query[Object](String query, Object[] args)
   at SQLite.SQLiteAsyncConnection.<>c__DisplayClass83_0`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<QueryAsync>b__0(SQLiteConnectionWithLock conn)
   at SQLite.SQLiteAsyncConnection.<>c__DisplayClass32_0`1[[System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<ReadAsync>b__0()
   at System.Threading.Tasks.Task`1[[System.Collections.Generic.List`1[[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)

 public async Task<List<dynamic>> GetItem()
    {
        var queryResult = await _db.QueryAsync<dynamic>("SELECT InvItm.*, BaseItmDet.*, FraCount FROM InvItm LEFT JOIN UnitsTb ON UnitsTb.Units = InvItm.Unit LEFT JOIN BaseItmDet ON InvItm.BaseId = BaseItmDet.BaseItemId WHERE ItemCode = '2'");
        return queryResult.ToList();
    }
0

There are 0 best solutions below