I use a cs convenience class to handle my sql queries. It is basic, you instantiate by specifying the db name, and it only manages one command/datareader duo at once.
public static void Connect (string DBName)
{
string connectionString =
"Server=serverNaaaaaaaaame;Database="
+ DBName
+ ";Integrated Security=SSPI;";
try
{
if (cnn != null)
cnn.Close ();
cnn = new SqlConnection (connectionString);
cnn.Open ();
}
catch (Exception e)
{
string aaaaaa = e.Message;
}
}
public void Command (string command)
{
try
{
if (drd != null)
drd.Dispose ();
if (cmd != null)
cmd.Dispose ();
cmd = new SqlCommand (command, cnn);
//cmd.CommandTimeout = 300;
drd = cmd.ExecuteReader ();
}
catch (Exception e)
{
string aaaaaa = e.Message;
}
}
As is, in the multi-threaded parts of my code, I often get timeouts. It seems to be due to my amount of concurrent connection being too high. (If I enter debug upon timeout and try to execute a query in mssqlsms it hangs until I stop the debug.)
I've been told about the Max Pool Size option to set in the connection string, however I can not see what it affects.
Does it change the quantity of SqlConnections I can plug to the same database?
Does it change the amount of concurrent SqlCommand and subsequent sqlDataReaders I can use at once? On the same SqlConnection? Something else?
Do I have to specify it in all my connection strings?
Does it have any effect if the database is already in use in another soft?