sql server - Speedup ExecuteReader in C# -


i'm using c# sqldatareader in many loops. unfortunately can't read whole table , store data in list. have create sqldatareader again , again. once sqldatareader created, fast. creation of sqldatareader via executereader takes time.

is there possibility improve creation time of sqldatareader?

i'm using .net 4.5.1 , sql server 2008.

string sql = "select current_timestamp"; var connection = connections.get();  sqlcommand sqlcommand = new sqlcommand(sql, connection); sqlcommand.commandtimeout = 0;  var reader = sqlcommand.executereader(commandbehavior.default); 

thanks michael

string constring = configurationmanager.connectionstrings["applicationservices"].tostring(); sqlconnection conn = new sqlconnection(constring); conn.open(); sqlcommand cmd = new sqlcommand("select  top 50000 * users", conn); datatable dt = new datatable(); sqldataadapter da = new sqldataadapter(cmd); da.fill(dt); 

please use datatable , sqldataadapter read data instead of using executereader


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -