I'm trying to use table name as variables
Base on this question here
I'm able to do it in some cases but in this one:
var usersId = db[tableNameLabel].All().Select(db[tableNameLabel].userid,
db[tableNameLabel].rating.Count().As("Count"));
I get the next error:
"The best overloaded method match for 'Simple.Data.DataStrategy.this[string]' has some invalid arguments"
Update:
Fixed it.
var usersId = db[tableNameLabel.Text].All().Select(db[tableNameLabel.Text].userid,
db[tableNameLabel.Text].rating.Count().As("Count"));
Needed tableNameLabel.Text.
Thanks
The only place in the code in the question where you use an indexer is in this expression:
db[tableNameLabel]
The error message:
he best overloaded method match for 'Simple.Data.DataStrategy.this[string]' has some invalid arguments
is noting an indexer, DataStrategy.this[string]
.
Clearly the compiler doesn't think that tableNameLabel
is of type string, so check out that variable and see what it is.
Perhaps you meant to dereference a property off of that variable?