123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Data.SqlClient;
- namespace Servise
- {
- internal class DataBase
- {
- /// <summary>
- /// установка соединения, указывается название сервера и входные данные
- /// </summary>
- SqlConnection sqlConnection = new SqlConnection(@"Data Source=ngknn.ru;Initial Catalog=YPpract;Persist Security Info=True;User ID=31П;Password=12357");
- public void openConect()
- {
- if (sqlConnection.State == System.Data.ConnectionState.Closed)
- {
- sqlConnection.Open();
- }
- }
- public void closeConect()
- {
- if (sqlConnection.State == System.Data.ConnectionState.Open)
- {
- sqlConnection.Close();
- }
- }
- public SqlConnection getConect()
- {
- return sqlConnection;
- }
- }
- }
|