• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

select query+time out+C#+window application

I am using a sqltableadpater as follows:

SqlTableAdpatper.Fill(dataset.table);

and when i am using this code i get an error, the meaning of the error is (query time out)

and what i know is that query needs a lot of time about 3 minutes.

how i can solved this problem?
0
MKItani
Asked:
MKItani
  • 4
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
change the execution timeout value of your command to a greater value.
0
 
MKItaniAuthor Commented:
how i can do it?
0
 
Éric MoreauSenior .Net ConsultantCommented:
You surely have a Command object (would be easier if you could show your code).

Set the CommandTimeOut property of your command to a value greater then 180 (which is in seconds). Check http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Éric MoreauSenior .Net ConsultantCommented:
0
 
MKItaniAuthor Commented:
thank you a lot.
so i will use SetCommandTimeOut()
but i am still confused in 2 issues and i hope to help me also.

i read that the CommandTimeout is The time in seconds to wait for the command to execute.

but my question is as follows :
is even the sql server begin the execution of the query and   before to the sql server  locate all the rows if the consuming time is greater than the "command time out"  we get the also the above error.

or the "CommandTimeout" is just  the consumed time before the sql server began to execute the command?

0
 
Éric MoreauSenior .Net ConsultantCommented:
the commandtimeout is the time required by your application to receive all the data (so the time of the SQL server + latency time)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now