-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plane_Front_end.cs
59 lines (54 loc) · 1.96 KB
/
Plane_Front_end.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace OOP_Front_End
{
public partial class Plane_Front_end : Form
{
Plane p1 = new Plane();
public Plane_Front_end()
{
InitializeComponent();
}
private void textBoxplanename_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
p1.Name = textBoxplanename.Text;
p1.Code = textBoxplancecode.Text;
p1.Capacity =int.Parse( textBoxplancecapacity.Text);
MySqlConnection con = new MySqlConnection("datasource=localhost; username=root; password=; database = oop");
string insertquery = "Insert into oop.plane(name,code,capacity) VALUES('" + p1.Name + "','" + p1.Code + "','" + p1.Capacity + "') ;";
}
private void Delete_Click(object sender, EventArgs e)
{
try
{
string MyConnection2 = "datasource=localhost; username=root; password=; database = oop";
string Query = "delete from plane where code='" + this.textBoxplancecode.Text + "';";
MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
MessageBox.Show("Data Deleted");
while (MyReader2.Read())
{
}
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}