Page 1 of 1

Can you add commandTimeout to ExecuteRows?

Posted: Thu Jul 13, 2023 8:38 am
by anv047

my code below fails because sql execution time is more than default time (30sec). Can I add code for sql to take more time for execution? it works fine if execution time is less. I want to give more time for stored procedure to run so I can display all data it pulls. Thanks in advance for any advice.

var dr = ExecuteRows("exec [dbo].[GetStaffDoc] '" + param1 + "', '"+ param2+"'", "DB");


Re: Can you add commandTimeout to ExecuteRows?

Posted: Tue Sep 12, 2023 11:50 am
by MichaelG

You can try:

var rows = GetConnection2("DB").DbConn2.Query("exec [dbo].[GetStaffDoc] '" + param1 + "', '" + param2 + "'", commandTimeout: 60).Select(row => (Dictionary<string, object>)ConvertToDictionary<object>(row)).ToList();