|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
When querying the same sql server with the same query (actually it is a stored procedure) i can show the results in 50sec. But, querying the same sql server with the same query takes more than 20minutes !! How come ?.. You can show the code at below: [cs] SqlConnection cnn = new SqlConnection(xx.MiddleTier.Common.Config.Connecti onString); cnn.Open(); SqlCommand cmd = new SqlCommand("GetStatisticsByCampaignIdInDateRange", cnn); cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; SqlParameter paramCampaignId = new SqlParameter("@campaignId", typeof(int)); SqlParameter paramDateFrom = new SqlParameter("@dateFrom", typeof(DateTime)); SqlParameter paramDateTo = new SqlParameter("@dateTo", typeof(DateTime)); paramCampaignId.Value = campaignId; paramDateFrom.Value = starts; paramDateTo.Value = ends; cmd.Parameters.Add(paramCampaignId); cmd.Parameters.Add(paramDateFrom); cmd.Parameters.Add(paramDateTo); //cmd.Prepare(); SqlDataReader r = cmd.ExecuteReader(CommandBehavior.CloseConnection) ; cmd.Dispose(); dgReportingTable.Visible = true; dgReportingTable.DataSource = r; dgReportingTable.DataBind(); [/cs] Thanks. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Performance Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|