-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add - sql server database integration
- Loading branch information
1 parent
2594ac9
commit a1fbfa6
Showing
15 changed files
with
200 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Data.SqlClient; | ||
using System.Windows.Forms; | ||
using System.Data; | ||
|
||
namespace SchoolManagementSystem.Classes | ||
{ | ||
public class Config | ||
{ | ||
private string ConnectionString = @"Data Source=(local);Initial Catalog=SeaAnimalQuiz;Integrated Security=True"; | ||
private SqlConnection _connection; | ||
private static Config _instance; | ||
|
||
private Config() | ||
{ | ||
_connection = new SqlConnection(ConnectionString); | ||
try | ||
{ | ||
_connection.Open(); | ||
} | ||
catch (Exception) | ||
{ | ||
MessageBox.Show("Connection failed, Please try again later.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
} | ||
public static Config Instance | ||
{ | ||
get | ||
{ | ||
if (_instance == null) | ||
_instance = new Config(); | ||
return _instance; | ||
} | ||
} | ||
public SqlConnection Connection | ||
{ | ||
get | ||
{ | ||
return _connection; | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.