This topic is locked
[SOLVED]

 Timeouts

1/23/2018 11:01:45 AM
ASPRunner.NET General questions
F
Frank I author

We have a large data set, and some complex SQL queries run for up to 90 seconds. I can run these queries just fine in management studio, but get timeouts after 30 seconds when running through the ASPRunner.net generated application (both from the local host and from the web server). Where can I adjust the connection string to extend the timeout setting?
Thanks

Frank

F
Frank I author 2/20/2018

This was solved by placing a timeout into the connections.cs file in the Source directory under the ASPRunner.NET application (not the output of the application I was building, but the ASPRunner.NET application itself in Program Files)
cmd.CommandTimeout = 120;
Below is where I placed the statement:

if (GlobalVars.dDebug)

MVCFunctions.EchoToOutput(sql.ToString() + "<br />");
GlobalVars.strLastSQL = sql;

DbCommand cmd = null;

DbCommand initCmd = null;

try {
DbConnection connection = connectionsPool.FreeConnection;

if (connection.State != System.Data.ConnectionState.Open)

{

connection.Open();

if( initializingSQL != null )

{

initCmd = GetCommand();

initCmd.Connection = connection;

initCmd.CommandText = initializingSQL;

initCmd.Prepare();

initCmd.ExecuteNonQuery();

}

}

cmd = GetCommand();

cmd.Connection = connection;

//Adding SQL timeout

cmd.CommandTimeout = 120;

cmd.CommandText = sql;

cmd.Prepare();
string commandStr = sql.ToLower().Substring(0, 6);

string [] stopCommandList = {"insert", "update", "delete", "create", "drop", "rename", "alter"};

if (stopCommandList.Any(x => commandStr.Substring(0, x.Length) == x))

{

cmd.ExecuteNonQuery();

CalculateLastInsertedId(commandStr, cmd);

cmd.Connection.Close();

return null;

}

else

{

RunnerDBReader rdr = cmd.ExecuteReader();

rdr.Connection = cmd.Connection;

return new QueryResult(this, rdr);

}

Pete K 2/20/2018

Thanks for sharing your solution, Frank. Good information to know.