-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySQL.cs
More file actions
68 lines (62 loc) · 1.72 KB
/
MySQL.cs
File metadata and controls
68 lines (62 loc) · 1.72 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Configuration;
namespace Teamproject1
{
class MySQL
{
string ServerName;
string DataBase;
string userid;
string userpw;
MySqlConnection connection;
public MySQL(string servername, string database, string userid, string userpw)
{
this.userid = userid;
this.userpw = userpw;
this.ServerName = servername;
this.DataBase = database;
}
public MySqlConnection Connection()
{
connection = new MySqlConnection("Server=" + ServerName + ";Database=" + DataBase + ";Uid=" + userid + ";Pwd=" + userpw);
return connection;
}
public Boolean DBConnection()
{
connection = new MySqlConnection("Server=" + ServerName + ";Database=" + DataBase + ";Uid=" + userid + ";Pwd=" + userpw);
connection.Open();
Boolean temp = connection.Ping();
if (temp == true)
{
return temp;
}
else
{
return temp;
}
}
public Boolean Sql(string SQL)
{
Boolean connection_result = DBConnection();
try
{
connection.Close();
return true;
}
catch
{
return false;
}
}
public string Select_Sql(string SQL)
{
return "";
}
}
}