-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarks_Student.cs
69 lines (63 loc) · 2.09 KB
/
Marks_Student.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
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace EducationManagementSystem
{
public partial class Marks_Student : UserControl
{
SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-OUS5TJV\SQLEXPRESS;database=OOPProject;UID=helloworld;password=hello");
int stdid, cid;
string course;
public Marks_Student()
{
InitializeComponent();
}
public void getdata(int stdid,int cid,string course)
{
this.stdid = stdid;
this.cid = cid;
this.course = course;
label10.Text = course;
dis();
}
public void dis()
{
con.Open();
SqlCommand cmd = new SqlCommand("select m.h1m,m.h2m,m.fm from student s left join marks m on m.s_id=@id ", con);
cmd.Parameters.AddWithValue("@id", stdid);
SqlDataReader reader = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(reader);
if (dt.Rows[0][0].ToString() == "")
{
dt.Rows[0][0] = 0;
}
if (dt.Rows[0][1].ToString() == "")
{
dt.Rows[0][1] = 0;
}
if (dt.Rows[0][2].ToString() == "")
{
dt.Rows[0][2] = 0;
}
label2.Text= dt.Rows[0][0].ToString();
label4.Text = dt.Rows[0][1].ToString();
label6.Text = dt.Rows[0][2].ToString();
label8.Text = (Convert.ToInt32(label2.Text)+Convert.ToInt32(label4.Text)+Convert.ToInt32(label6.Text)).ToString();
con.Close();
}
private void Marks_Student_Load(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}