T
tshad
I am having a problem with my Web Page and closing connections as well as
running very slow after filling my dropdown objects.
If I run my page and continually hit my button that fills my GridView object
it fills it in about 1 second.
But when I run a stored procedure from my dropdown, I am finding that my
connection is staying open.
Once I open my dropdown and then hit my button again, I am finding that it
is taking about 45 seconds to display the data (I am only displaying 15
rows).
I found 2 issues.
One is that the connections seem to be staying open.
My procedure is:
SqlCommand dbCommand;
dbCommand = new SqlCommand("GetClientName",
new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString));
dbCommand.CommandType = CommandType.StoredProcedure;
dbCommand.Connection.Open();
ddlClient.DataSource =
dbCommand.ExecuteReader(CommandBehavior.CloseConnection);
ddlClient.DataTextField = "ClientName";
ddlClient.DataValueField = "ClientId";
ddlClient.DataBind();
ddlClient.Items.Insert(0, " --All--");
Wouldn't the CommandBehavior.CloseConnection close the connect when it fills
the dropdown?
I look at sp_who2 and keep seeing that connection is still open.
I thought this might be causing my problem as I was seeing about 10
connection opens due by dropdowns.
But after tracing the page, I found that it is going slow AFTER the
PreRender event is run.
At that point, the Ajax progress image stops spinning and it takes about 45
seconds to finish.
There are about 9 dropdowns on the page - but most of them are not filled
and the ones that are are only filled with 5-15 items.
And the grid isn't very large so why would it take so long to Render?
Could Ajax be causing the problem????
Thanks,
Tom
running very slow after filling my dropdown objects.
If I run my page and continually hit my button that fills my GridView object
it fills it in about 1 second.
But when I run a stored procedure from my dropdown, I am finding that my
connection is staying open.
Once I open my dropdown and then hit my button again, I am finding that it
is taking about 45 seconds to display the data (I am only displaying 15
rows).
I found 2 issues.
One is that the connections seem to be staying open.
My procedure is:
SqlCommand dbCommand;
dbCommand = new SqlCommand("GetClientName",
new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString));
dbCommand.CommandType = CommandType.StoredProcedure;
dbCommand.Connection.Open();
ddlClient.DataSource =
dbCommand.ExecuteReader(CommandBehavior.CloseConnection);
ddlClient.DataTextField = "ClientName";
ddlClient.DataValueField = "ClientId";
ddlClient.DataBind();
ddlClient.Items.Insert(0, " --All--");
Wouldn't the CommandBehavior.CloseConnection close the connect when it fills
the dropdown?
I look at sp_who2 and keep seeing that connection is still open.
I thought this might be causing my problem as I was seeing about 10
connection opens due by dropdowns.
But after tracing the page, I found that it is going slow AFTER the
PreRender event is run.
At that point, the Ajax progress image stops spinning and it takes about 45
seconds to finish.
There are about 9 dropdowns on the page - but most of them are not filled
and the ones that are are only filled with 5-15 items.
And the grid isn't very large so why would it take so long to Render?
Could Ajax be causing the problem????
Thanks,
Tom