c# - Cannot convert method group to non delegate type System.Data.Datatable -
cannot convert method group non delegate type system.data.datatable. did intend invoke method? i'm using design pattern mvp (model view presenter)
so have datatable in model
datatable _getpendingtestorders24hours() { var connsettings = configurationmanager.connectionstrings["mydb"]; { string cn = connsettings.connectionstring; mysqlconnection conn = new mysqlconnection(cn); mysqlcommand cmd = new mysqlcommand("", conn); mysqldataadapter data = new mysqldataadapter(cmd); conn.open(); data.fill(_dt); return _dt; } }
and , setter pass parameters controller
public datatable getpendingtestorders24hours { { return _getpendingtestorders24hours; } set { _getpendingtestorders24hours = value; } }
but i'm getting error above
you're attempting return method group, _getpendingtestorders24hours
method.
if want return datatable
, need invoke method:
public datatable getpendingtestorders { { return getpendingtestorders24hours(); } }
as side note, if have method queries database, perhaps setting read property invokes might redundant.
also, note should follow c# naming coventions. method shouldn't start _
.
Comments
Post a Comment