1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _02Trade
- {
- class DB
- {
- SqlConnection sqlconnection = new SqlConnection(@"Data Source=(localdb)\05Str; Initial Catalog=02Trade;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;
- }
- }
- }
|