Hi Friends!!

I am coming across this problem that whenever I am trying to retrieve the data in a dataset through SQLDataAdapter and Dataset, it is taking around 10 min to get the data on the localhost. And when I am running the same code on the live server it doesnot take time at all and I get the data in few seconds only.
My dataset Contains three tables, first one containing 25rows and each row containing 12 columns. Second and Third Table contains 25 rows and 2 columns.

My code looks like this.

DataSet ds = new DataSet();
SqlConnection connect;
connect=connecttodatabase() 
/* connecttodatabase is a method used to connect to the database by setting the connection string. */
SqlCommand command = new SqlCommand("GetAssignment", connect);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.ADD("@assignmentId", SqlDbType.BigInt).Value = assignmentId;
command.CommandTimeout = 0;
SqlDataAdapter sda = new SqlDataAdapter(command);
sda.Fill(ds, " ");
RETURN ds;

Can anyone tell me the solution to this.
Help Needed!!!

Thanks in advance :)

I know that running locally, especially in debug, slows things down but 10 minutes for that amount of data is crazy. Is your database being used by a lot of other stuff (seems unikely) or is your CPU running at close to 100% for some reason?

every thing is ok in code according to me use datareader if u don't need to use adapter in future it will fast your work

Hi arsheena.alam,

This could be your system issue. Please check for any applications sharing your data services or the database or if possible you may try the debugging on some other machine.
Hope that may help.

Arsheena.alam Try getting the list of processes(CTRL+ALT+DEL) see how much memory and CPU your sql is consuming.

Thanks friends for your suggestions!!!
@Hericles,
No my database is not being used by other stuffs.There might be cases when the connection is established thrice at a time to interact with the database in different functions/methods ,But everytime a connection is established it closes itself after the completion of that block.So in this case i Dont think there will be a problem of connection pooling errors. My CPU usage is also not much

@KM499
I have tried duebugging the same code on other machine and still its giving the same problem. I got the dataset after waiting for 8 minutes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.