TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Alex Lonyay
NA
123
9.6k
In MS Test - running parallel tests - sql timeout comes
May 20 2020 5:18 AM
I have framework which runs 12 threads parallel - each will have different test but may have to get result from sql connection
Doing so - I'm receiving below error - Is there a way where I can do any workaround in my code to make it work without loosing parallel threads
System.Data.SqlClient.SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding..
My Config:
<add name="ConnectionString1" connectionString="data source=54.154.178.120;initial catalog=test;persist security info=true;user id=admin;password=admin" providerName="System.Data.SqlClient" />
Code:
private static void ExecuteQuery(TestConfigurationCDO testConfiguration, string query)
{
using (var sqlConnection = new SqlConnection(testConfiguration.ConnectionString))
{
var orderTable = sqlConnection.ExecuteQuery(query);
}
}
//Execution
public static DataTable ExecuteQuery(this SqlConnection sqlConnection, string queryString)
{
if (sqlConnection == null) throw new ArgumentNullException(nameof(sqlConnection));
DataSet dataset;
try
{
//Checking the state of the connection
if (sqlConnection.State == ConnectionState.Closed ||
sqlConnection.State == ConnectionState.Broken)
sqlConnection.Open();
SqlDataAdapter dataAdaptor = new SqlDataAdapter
{
SelectCommand = new SqlCommand(queryString, sqlConnection) { CommandType = CommandType.Text }
};
dataset = new DataSet();
dataAdaptor.Fill(dataset, "table");
sqlConnection.Close();
return dataset.Tables["table"];
}
catch (Exception e)
{
dataset = null;
sqlConnection.Close();
Console.WriteLine("ERROR {0}", e);
//LogHelpers.Write("ERROR :: " + e.Message);
return null;
}
finally
{
sqlConnection.Close();
dataset = null;
}
}
Reply
Answers (
2
)
Zephyr for jira Test cases example
how to edit, delete data in dynamic html table in asp.net