-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDBConnect.cs
38 lines (34 loc) · 863 Bytes
/
DBConnect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace SMS_Server
{
internal class DBConnect
{
MySqlConnection connect = new MySqlConnection("datasource=localhost;port=3306;username=root1;password=root;database=studentdb");
public MySqlConnection getconnection
{
get
{
return connect;
}
}
public void openConnect()
{
if (connect.State == System.Data.ConnectionState.Closed)
{
connect.Open();
}
}
public void closeConnect()
{
if (connect.State == System.Data.ConnectionState.Open)
{
connect.Close();
}
}
}
}