Link to home
Start Free TrialLog in
Avatar of MKItani
MKItani

asked on

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?
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

change the execution timeout value of your command to a greater value.
Avatar of MKItani
MKItani

ASKER

how i can do it?
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
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MKItani

ASKER

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?

the commandtimeout is the time required by your application to receive all the data (so the time of the SQL server + latency time)