12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.SqlClient;
- namespace Perevozki
- {
- class DB
- {
- SqlConnection sqlconnection = new SqlConnection(@"Data Source=class31000;Initial Catalog=PerevozkiBD;Integrated Security=True");
- public void OpenConnection()
- {
- if (sqlconnection.State == System.Data.ConnectionState.Closed)
- {
- sqlconnection.Open();
- }
- }
- public void CloseConnection()
- {
- if (sqlconnection.State == System.Data.ConnectionState.Open)
- {
- sqlconnection.Close();
- }
- }
- public SqlConnection GetConnection()
- {
- return sqlconnection;
- }
- }
- }
|