tags:

views:

35

answers:

1

Hi, I have a sql query which takes longer than 30seconds to execute. I'm aware I need to set the CommandTimeout for the command object to overcome this. However, the first place the command object occurs is within the method 'LoadDataSet' within the Enterprise Library.

I don't think I want to be modifying it here.

Could someone please suggest to me an appropriate place to set it?

Thanks!

+1  A: 

Try this:

dcCommand = dDatabase.GetSqlStringCommand(sSQLCommand);
dcCommand.CommandTimeout = 60;      //**This is the key statement**
dDatabase.LoadDataSet(dcCommand, dsDataSet , saTableNames);

Instead of this

dDatabase.LoadDataSet(CommandType.Text, sSQLCommand, dsDataSet , saTableNames);
Sidharth Panwar
Thanks, that's what I was after!
Mr Cricket