I have at small web-application that get some data from a SQLdb in Visual Studio 2010. When i try to display this, using a simple dropdownlist it takes around 15 sec the first time just after compilation and then after that 5 sec every request. I use a LINQ connection to db and a repeater to print everything out. It´s four columns and around 50 rows, so not so mutch data. It doesn´t matter if i try take 10 rows, same response time.
We have tested the same thing on another computer with VS2008 installed and the time was like 0.1 sec or something like that. I use .NET 3.5 and have installed all the latest updates (SP1 and so).
If i look at the trace i see it takes time at these rows in my code:
var cust = dbContext.Customers
.Select(c => new
{
c.customerID,
c.Email
}).Take(10);
repeater.DataSource = cust;
repeater.DataBind();
Anybody know what could be taking som mutch time?
Regards Daniel
I have tried this other aproach:
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = connection;
cmd.CommandType = CommandType.Text; //default
cmd.CommandText = "SELECT Email FROM Customer";
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
It takes just as long.. there must be some other more fundamental problem than the code to call the db i think?
Some more information: I did som trace, this is first time page is loaded:
Begin Raise ChangedEvents 0,00219604937555932 0,000014
After repeater has printed 15,8138335259613 15,811637
End Raise ChangedEvents 15,8138801733289 0,000047
Second time:
Begin Raise ChangedEvents 0,00219604937555932 0,000014
After repeater has printed 5,25090396258066 5,248825
End Raise ChangedEvents 25095106283536 0,000047
What´s happening at ChangeEvents?