I am working with C# application using Sqlite-net. My query should return a single column value, but when i run the query i get the exception. My code is:

foreach(var group in groups)
{   
    var groupNameCmd = EdgeDatabase._connection.CreateCommand(@"SELECT Name from tblGroup WHERE Id = " + group.Id);
    List<string> groupName = groupNameCmd.ExecuteQuery<string>();
}

On the "ExecuteQuery" i get the exception "no parameterless constructor defined for this object".

1 Answers

-1
user10103607 On

You have used group.Id while creating your SQL command. This group should be an instance of a class.

Check if there is a parameter less constructor present in the class of which group is an instance of. If not, try adding a parameter less constructor to that class.