Class1.cs 845 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data.SqlClient;
  6. namespace yrok2
  7. {
  8. class Class1
  9. {
  10. SqlConnection sqlConnection = new SqlConnection("Data Source=class31000;Initial Catalog=authorizationkhozeev;Integrated Security=True");
  11. public void openConnection()
  12. {
  13. if (sqlConnection.State == System.Data.ConnectionState.Closed)
  14. {
  15. sqlConnection.Open();
  16. }
  17. }
  18. public void closeConnection()
  19. {
  20. if (sqlConnection.State == System.Data.ConnectionState.Open)
  21. {
  22. sqlConnection.Close();
  23. }
  24. }
  25. public SqlConnection GetConnection()
  26. {
  27. return sqlConnection;
  28. }
  29. }
  30. }