I am executing stored procedure using ExcuteReader() command. If I execute Stored Procedure in SQL server it is taking 2 secs. But in code taking around 2 mins. I tried DataAdapter.Fill(). Still the same.
What is wrong in the code?
spString = "usp_graph"
sqlcmd_q.Connection = sqlCnn
sqlcmd_q.CommandText = spString
sqlcmd_q.CommandType = CommandType.StoredProcedure
sqlcmd_q.Parameters.AddWithValue("@clientid", clientId)
sqlcmd_q.Parameters.AddWithValue("@store", storeID)
sqlcmd_q.Parameters.AddWithValue("@attributes", attributeNumber)
sqlcmd_q.Parameters.AddWithValue("@attri1_idx", attribute1_idx)sqlCnn.Open()
sqlcmd_q.CommandTimeout = 300
sqldr = sqlcmd_q.ExecuteReader() // taking time here
dt.Load(sqldr)
dsGrid.Tables.Add(dt)
set dateformatin your stored proc? I've come across stored procs with aset dateformatslowing things down, yet it will run fine in SSMS when the query is cached.