So what i'm looking to do is open a MysqlConnection and then never close it for the entire application (until the end).
I have this:
static void Main(string[] args)
{
OpenCon();
}
public static MySqlConnection OpenCon()
{
MySqlConnection masterOpenCON = new MySqlConnection(SQLStringClass.masterConString);
masterOpenCON.Open();
return masterOpenCON;
}
However, i believe this will continuously open the connect, how do i open the connection once and reference the connection throughout the app. This is how I am calling it right now.
try
{
MySqlCommand mysqlprocessCmdInsertItem = new MySqlCommand(SQLStringClass.mySQLCOMMAND, OpenCon());
mysqlprocessCmdInsertItem.ExecuteNonQuery();
}