Adjusted open and close connections
This commit is contained in:
parent
04f5d9856b
commit
68b8439256
@ -209,7 +209,7 @@ namespace TeamHobby.HobbyProjectGenerator.ArchiveTests
|
||||
if (sqlDAO.GetType() == typeof(SqlDAO))
|
||||
{
|
||||
sqlDS = (SqlDAO)sqlDAO;
|
||||
sqlDS.GetConnection().Open();
|
||||
//sqlDS.GetConnection().Open();
|
||||
|
||||
// Act
|
||||
Console.WriteLine("\nInserting into archive...");
|
||||
@ -249,7 +249,7 @@ namespace TeamHobby.HobbyProjectGenerator.ArchiveTests
|
||||
Console.WriteLine("\nExpected: {0}, Actual: {1}. Entries not removed.", expectedVal, actualVal);
|
||||
}
|
||||
|
||||
sqlDS.GetConnection().Close();
|
||||
//sqlDS.GetConnection().Close();
|
||||
}
|
||||
|
||||
return;
|
||||
@ -299,6 +299,7 @@ namespace TeamHobby.HobbyProjectGenerator.ArchiveTests
|
||||
"PASSWORD=Teamhobby;" +
|
||||
"OPTION=3";
|
||||
SqlDAO sqlDAO = new SqlDAO(dbInfo);
|
||||
sqlDAO.GetConnection().Open();
|
||||
//ArchiveManager archiveManager = new ArchiveManager(sqlDAO);
|
||||
|
||||
// Testing folder creation
|
||||
@ -333,7 +334,7 @@ namespace TeamHobby.HobbyProjectGenerator.ArchiveTests
|
||||
test.RemoveOutputFileTest(sqlDAO);
|
||||
Console.WriteLine("-----------------");
|
||||
Console.WriteLine("");
|
||||
|
||||
sqlDAO.GetConnection().Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ namespace TeamHobby.HobbyProjectGenerator.DataAccess
|
||||
public bool CopyToFile(string filePath){
|
||||
try
|
||||
{
|
||||
_conn.Open();
|
||||
//_conn.Open();
|
||||
// Conver backward slash in to forward slash
|
||||
filePath = filePath.Replace("\\", "/");
|
||||
string sqlQuery = "SELECT 'LtimeStamp', 'logID', 'LvName', 'catName', 'userOP', 'logMessage' " +
|
||||
@ -200,19 +200,19 @@ namespace TeamHobby.HobbyProjectGenerator.DataAccess
|
||||
Console.WriteLine("Output to a file completed. ");
|
||||
|
||||
|
||||
_conn.Close();
|
||||
//_conn.Close();
|
||||
return true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_conn.Close();
|
||||
//_conn.Close();
|
||||
Console.WriteLine("Error when copying query to a file !!, will be handled higher up the call stack");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_conn.Close();
|
||||
//_conn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user