-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateClassroom.cs
47 lines (43 loc) · 1.41 KB
/
CreateClassroom.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
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;
namespace Teacher_s_Student_And_Class_Management_System
{
public partial class CreateClassroom : Form
{
private string query = "";
//DataAccess da = new DataAccess(); //Connecting DB
//DataSet ds;
public static int totalClassNumber;
internal string Id
{
get;set;
}
public CreateClassroom(string id)
{
Id = id;
InitializeComponent();
}
private void btnCreateClass_Click(object sender, EventArgs e)
{
DataAccess.Ds = DataAccess.ExecuteQuery("Select *from "+Id+"classrooms;");
totalClassNumber = DataAccess.Ds.Tables[0].Rows.Count;
//MessageBox.Show(totalClassNumber.ToString());
int u = DataAccess.ExecuteUpdateQuery(@"INSERT INTO " + Id + "classrooms" + " VALUES(" +
"" + (totalClassNumber+1) + ", " +
"'" + txtClassName.Text + "'); ");
if (u == 1)
{
MessageBox.Show("Classroom created successfully!");
this.Close();
}
else MessageBox.Show("Error!");
}
}
}