Skip to content

Commit

Permalink
Database Error Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfredpine committed Sep 17, 2021
1 parent 6be5b48 commit 2e4fc54
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 16,457 deletions.
Binary file modified .vs/C-Sharf Classes/v15/.suo
Binary file not shown.
Binary file modified .vs/C-Sharf Classes/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/C-Sharf Classes/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
Binary file added .vs/C-Sharf Classes/v16/.suo
Binary file not shown.
14 changes: 5 additions & 9 deletions C-Sharf Classes/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class Database : Config

// connection string
private static string constring = "server=localhost;uid=" + dbuser + ";pwd='" + dbpassword + "';database=" + dbname;

// MySql Classes
public MySqlConnection con = new MySqlConnection(constring);
MySqlCommand cmd;
MySqlDataReader reader;
Expand All @@ -57,15 +59,9 @@ class Database : Config
public Database()
{
con = new MySqlConnection(constring);
try
{
if(con.State == ConnectionState.Closed)
con.Open();
}
catch (Exception ex)
if (con.State == ConnectionState.Closed)
{
Application.Exit();
MessageBox.Show(ex.Message);
con.Open();
}
}

Expand Down Expand Up @@ -93,7 +89,7 @@ public void cud(string qry, string msg = "")
if (cmd.ExecuteNonQuery() > 0)
{
if (msg == "")
MessageBox.Show("Transaction Complete!");
MessageBox.Show("Transaction Completed!");
else
MessageBox.Show(msg);
}
Expand Down
17 changes: 13 additions & 4 deletions C-Sharf Classes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@ static class Program
[STAThread]
static void Main()
{
Database db = new Database();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmLogin());
try
{
Database db = new Database();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmLogin());
}
catch(Exception)
{
MessageBox.Show("Database Connection Error! The application will exit.");
System.Environment.Exit(1);
}

}
}
}
Binary file modified C-Sharf Classes/bin/Debug/C-Sharf Classes.exe
Binary file not shown.
Binary file modified C-Sharf Classes/bin/Debug/C-Sharf Classes.pdb
Binary file not shown.
Binary file removed C-Sharf Classes/bin/Debug/Google.Protobuf.dll
Binary file not shown.
16,426 changes: 0 additions & 16,426 deletions C-Sharf Classes/bin/Debug/MySql.Data.xml

This file was deleted.

41 changes: 24 additions & 17 deletions C-Sharf Classes/frmLogin.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions C-Sharf Classes/frmLogin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ private void txtUsername_KeyPress(object sender, KeyPressEventArgs e)
{
validate.alphanum(e);
}

}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c170af2024081f557875ad7df8021349f4936403
fefa04dddff5ccdef55920917e2215c351bb1d5d
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,18 @@ C:\wamp64\www\GIT\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf C
C:\wamp64\www\GIT\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.csproj.CopyComplete
C:\wamp64\www\GIT\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.exe
C:\wamp64\www\GIT\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.pdb
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\bin\Debug\C-Sharf Classes.exe.config
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\bin\Debug\C-Sharf Classes.exe
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\bin\Debug\C-Sharf Classes.pdb
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C_Sharf_Classes.frmLogin.resources
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C_Sharf_Classes.Properties.Resources.resources
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C_Sharf_Classes.View.frmDashboard.resources
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C_Sharf_Classes.View.frmDataGridView.resources
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C_Sharf_Classes.View.frmInputs.resources
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C_Sharf_Classes.View.frmMain.resources
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.csproj.GenerateResource.cache
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.csproj.CoreCompileInputs.cache
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.csproj.CopyComplete
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.exe
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.pdb
C:\wamp64\www\wamp-projects\Github Projects\CSharf-Custom-Classes-main\C-Sharf Classes\obj\Debug\C-Sharf Classes.csprojAssemblyReference.cache
Binary file not shown.
Binary file not shown.
Binary file modified C-Sharf Classes/obj/Debug/C-Sharf Classes.exe
Binary file not shown.
Binary file modified C-Sharf Classes/obj/Debug/C-Sharf Classes.pdb
Binary file not shown.
Binary file not shown.

0 comments on commit 2e4fc54

Please sign in to comment.