How can I implement paging for DataGridView in Winform scenario when using Entity Framework? -


all can find on net asp.net use. want retrieve page count amount of records database every time. isn't possible?

the bottleneck seems disposal of context. dunno how resolve this.

thanks.
nico

if need simple sql query can use example:

using system; using system.data.sqlclient;  class program { static void main() {     //     // name trying match.     //     string dogname = "fido";     //     // use preset string connection , open it.     //     string connectionstring = consoleapplication1.properties.settings.default.connectionstring;     using (sqlconnection connection = new sqlconnection(connectionstring))     {         connection.open();         //         // description of sql command:         // 1. selects cells rows matching name.         // 2. uses operator because name text field.         // 3. @name must added new sqlparameter.         //         using (sqlcommand command = new sqlcommand("select count(*) dogs1 name @name", connection))         {             //             // add new sqlparameter command.             //             command.parameters.add(new sqlparameter("name", dogname));             //             // read in select results.             //             sqldatareader reader = command.executereader();             while (reader.read())             {                 int count = reader[0];             }              // call close when done reading.             reader.close();         }     } } } 

keep in mind you'll need find out connectionstring database. depend on database have can use google find out how it.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -