DataBase.cs 848 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlClient;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace muskafidi_de
  8. {
  9. class DataBase
  10. {
  11. SqlConnection sqlConnection = new SqlConnection(@"Data Source=Class31000;Initial Catalog=06_muskafidi_de;Integrated Security=True");
  12. public void openConnetction()
  13. {
  14. if (sqlConnection.State == System.Data.ConnectionState.Closed)
  15. {
  16. sqlConnection.Open();
  17. }
  18. }
  19. public void closeConnetction()
  20. {
  21. if (sqlConnection.State == System.Data.ConnectionState.Open)
  22. {
  23. sqlConnection.Close();
  24. }
  25. }
  26. public SqlConnection getConnection()
  27. {
  28. return sqlConnection;
  29. }
  30. }
  31. }