c# - 'System.Data.Entity.DbSet<Survey.Models.Survey>.DbSet()' is inaccessible due to its protection level -
can me understand error? i'm getting on line new dbset<survey>();
in block code
public dbset<survey> getallsurveys ( ) { dbset<survey> allsurveys = new dbset<survey>(); using ( sqlcommand cmd = new sqlcommand("getallsurveys", this._conn) ) { cmd.commandtype = commandtype.storedprocedure; this._conn.open(); using ( sqldatareader datareader = cmd.executereader() ) { while ( datareader.read() ) { survey srv = new survey { id = datareader.isdbnull(0) ? default(int) : datareader.getint32(0), title = datareader.isdbnull(1) ? string.empty: datareader.getstring(1) }; allsurveys.add(srv); } } this._conn.close(); } return allsurveys; }
what's strange i'm not getting when create dbset<t>
right below:
public dbset<question> getquestionsbysurveyid ( int survid ) { sqlcommand cmd = new sqlcommand("getquestionsbysurveyid", this._conn); cmd.commandtype = commandtype.storedprocedure; cmd.parameters.addwithvalue("@id", survid); this._conn.open(); dbset<question> thesequestions = (dbset<question>)cmd.executescalar(); this._conn.close(); return thesequestions; }
has no errors associated it. what's difference between these two?
Comments
Post a Comment