I've tried it this way, the line cmd.ExecuteReader(); takes about 300 sec to execute
Thanks
Jos
----- Sachy wrote: ----
I had many problems with dataadapter. So I replaced it with DataReader. There is lot of coding involved when you have to show data in a grid because easiest way to do it is bind it to DataSet. So this is what I do. I am sure your code will work this way too.
//This is my own class to capture NameObject collectio
NameObjectCollection retList = new NameObjectCollection()
SqlDataReader redr
conn = new SqlConnection(connString)
conn.Open()
cmd.Connection = conn
redr = cmd.ExecuteReader(); // cmd is passed as a paramete
If (redr == null
throw new Exception("Unable to populate reader obj")
cmd.Dispose()
while (redr.Read()
NameObjectCollection record = new NameObjectCollection()
while (true
tr
ObjValue=redr[columnCount]
columnCount++
record.Add("Column" + columnCount.ToString(), ObjValue)
catch (Exception
break
columnCount = 0
rowCount++
retList.Add(rowCount.ToString(), record)
redr.Close()
conn.Dispose()
return retList
--now create datatable objec
--create column objects and add 'em to datatable
--loop thru the collection returned by the code above (It is actually collection of Collections) an
--populate data in the datatabl
--close the collection object
--bind it to your datagri
--close datatable
When I did same thing with dataset populated using Dataadapter, when the more 20-30 users tried to run it, it would throw and object reference error and datasets were not populated.
HTH
Sach
----- JoshuaLuke wrote: ----
I have tried what he suggested, I have made the call through SqlHelper.ExecuteDataSet with the same result
I have stepped through the code and it is the execute commands, not the binding that takes a long time
I have tried calling it with commandtype = sproc and passing the the params
If I set the CommandTimeout = 120 then the execute operations time out and it never gets to the databinding line. The operation should not even take 2 min when it only takes 1-3 sec in QA
Any other pointers
Thanks
Jos
----- Miha Markic [MVP C#] wrote: ----
Hi
Yeah, just like Jeff said, comment grid.DataBind() line and see wha
happens
You might also consider timing only the ExecutReader line withou
Connction.Open() as it takes some time
--
Miha Markic [MVP C#] - RightHand .NET consulting & software developmen
miha at rthand co
www.rthand.co
JoshuaLuke said:
I am running an sproc that runs in 2-3 sec using query analyzer, but take
just under 5 min using .net data providers (I've used SqlClient, OleDb, an
Data block v2