private void Studentsdetailedlist_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676288_cmyk_04); dtp.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); SqlControl sql = new SqlControl(); sql.ExecSql("select class as [class] ,section as [section] from class"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboclass.Items.Contains(r["class"]) == false) { cboclass.Items.Add(r["class"]); } if (cbosection.Items.Contains(r["section"]) == false) { cbosection.Items.Add(r["section"]); } } sql.ExecSql("select name from students"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboname.Items.Contains(r["name"]) == false) { cboname.Items.Add(r["name"]); } } }
private void bnload_Click(System.Object sender, System.EventArgs e) { SqlControl sql = new SqlControl(); if (cboname.Text != "" & cbosub.Text != "") { sql.addprams("@name", cboname.Text); sql.addprams("@sub", cbosub.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select *from dbo.show_marks(@name,@sub,@date)"); if (sql.count <= 0) { sql.addprams("@name", cboname.Text); sql.addprams("@sub", cbosub.Text); sql.addprams("@date", dtp.Value); sql.ExecProc("Exec insert_marks @date,NULL,@sub,@name"); bnload_Click(sender, e); return; } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; if (sql.exep != "") { MessageBox.Show(sql.exep); return; } return; } if (cboname.Text != "" & cbosub.Text == "") { sql.addprams("@name", cboname.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * From dbo.show_marks(@name,default,@date)"); bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; if (sql.exep != "") { MessageBox.Show(sql.exep); return; } return; } if (cboname.Text == "" & cbosub.Text != "") { sql.addprams("@sub", cbosub.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * from dbo.show_marks(default,@sub,@date)"); bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; if (sql.exep != "") { MessageBox.Show(sql.exep); return; } return; } }
private void cboname_SelectedIndexChanged(System.Object sender, System.EventArgs e) { if (cboclass.Text != "" & cboname.Text != "" & cbosection.Text != "") { sql.addprams("@name", cboname.Text); sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * from dbo.show_classsection(@name,@class,@section,@date)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } } else { sql.addprams("@name", cboname.Text); sql.addprams("@date", dtp.Value); sql.ExecSql("select * from dbo.show_classsection(@name,default,default,@date)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
private void ManageTeacher_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676422_Teacher_male_24); sql.addprams("@name", TextBox1.Text); sql.ExecSql("Select * from dbo.teacher_show(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
public void ManageServices_Load(object sender, EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources.gear_icon); sql.ExecSql("select services.id as ID, services.name as Name, recurnames.name as [Frequency], amount as [Amount] from services left join recurnames on recurnames.id = services.recur"); if (sql.exep != "") { MessageBox.Show(sql.exep); } bind.DataSource = sql.data.Tables[0]; dataGridView1.DataSource = bind; dataGridView1.Columns["ID"].Visible = false; }
private void document_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e) { int height = 100; SqlControl sql = new SqlControl(); sql.ExecSql("select name,due from students where due>0"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } Font fontss = new Font("Arial", 22); e.Graphics.DrawString("The List of Students With Due", fontss, Brushes.ForestGreen, 200, 50); Font fonts = new Font("Arial", 10); var loopTo = sql.count - 1; for (var r = index; r <= loopTo; r++) { e.Graphics.DrawRectangle(Pens.Black, 100, height, 200, 40); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["due"].ToString(), fonts, Brushes.Black, 400, height + 5); e.Graphics.DrawString(sql.data.Tables[0].Rows[r]["name"].ToString(), fonts, Brushes.Black, 100, height + 5); e.Graphics.DrawLine(Pens.Black, 350, height + 20, 320, height + 20); e.Graphics.DrawRectangle(Pens.Black, 400, height, 150, 40); height += 80; if (height > 1000) { height = 100; index = r + 1; e.HasMorePages = true; return; } } }
private void cbofill_SelectedIndexChanged(System.Object sender, System.EventArgs e) { if (boons == true) { SqlControl sql = new SqlControl(); if (cboclass.Text != "" & cbosection.Text != "") { sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } int num = 1; var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { ComboBox combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; if (cbofill.SelectedIndex == 0) { combo.SelectedIndex = 0; } else { combo.SelectedIndex = 1; } num += 1; } } } }
private void cboname_SelectedIndexChanged(System.Object sender, System.EventArgs e) { SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.ExecSql("select * from dbo.show_students(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } if (sql.count != 0) { Grpdetails.Visible = true; picbox.ImageLocation = sql.data.Tables[0].Rows[0]["pic"].ToString(); lblage.Text = sql.data.Tables[0].Rows[0]["age"].ToString(); lblclass.Text = sql.data.Tables[0].Rows[0]["Class"].ToString(); lblname.Text = sql.data.Tables[0].Rows[0]["Student Name"].ToString(); lblsection.Text = sql.data.Tables[0].Rows[0]["Section"].ToString(); lbldue.Text = sql.data.Tables[0].Rows[0]["due"].ToString(); return; } makepay_Click(sender, e); }
private void OK_Click(System.Object sender, System.EventArgs e) { if (UsernameTextBox.Text == "" | PasswordTextBox.Text == "") { MessageBox.Show("Enter your Username and password!", "Fields Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } sql.addprams("@name", UsernameTextBox.Text); sql.addprams("@pass", PasswordTextBox.Text); sql.ExecSql("Select * from users where username = @name and pass = @pass"); if (sql.count == 0) { MessageBox.Show("Invalid Username or Password", "Wrong info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); UsernameTextBox.Clear(); PasswordTextBox.Clear(); UsernameTextBox.Focus(); return; } else { this.Hide(); MainInterface mainInterface = new MainInterface(); mainInterface.FormClosed += (s, args) => this.Close(); mainInterface.Show(); } }
private void cbofill_SelectedIndexChanged(System.Object sender, System.EventArgs e) { if (boons == true) { SqlControl sqls = new SqlControl(); sqls.ExecSql("select * from teacher"); if (sqls.exep != "") { MessageBox.Show(sqls.exep); return; } int num = 1; var loopTo = sqls.count; for (var j = 1; j <= loopTo; j++) { ComboBox combo = new ComboBox(); combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; if (cbofill.SelectedIndex == 0) { combo.SelectedIndex = 0; } else { combo.SelectedIndex = 1; } num += 1; } } }
private void MainInterface_Load(System.Object sender, System.EventArgs e) { if (DateTime.Now.Day == 1) { this.FeesStructures.CreateOrShow(); this.FeesStructures.MdiParent = this; } sqlm.ExecSql("select id from students where due>0"); if (sqlm.count != 0) { NotifyIcon1.BalloonTipText = sqlm.count + " Students have to pay the fees"; NotifyIcon1.BalloonTipTitle = "Fee Info"; NotifyIcon1.ShowBalloonTip(100); } sqlm.ExecProc("exec update_leaves"); sqlm.ExecSql(""); }
private void bnsave_Click(System.Object sender, System.EventArgs e) { if (txtemail.Text == "" | txtfullname.Text == "" | txtphone.Text == "" | txtaddress.Text == "" | cbodesignation.Text == "" | cbogender.Text == "" | txtqua.Text == "") { MessageBox.Show("No fields must be left blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (long.Parse(txtphone.Text) < 10000000) { MessageBox.Show("Invalid Phone number!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } sql.addprams("@name", txtfullname.Text); sql.ExecSql("select name from teacher where name = @name"); if (sql.count != 0) { MessageBox.Show("There is already a student with exact name please make a little adjustment to help the software :) ", "Same Full names", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } sql.addprams("@name", txtfullname.Text); sql.addprams("@gender", cbogender.SelectedIndex + 1); sql.addprams("@dob", DateTimePicker1.Value); sql.addprams("@desig", cbodesignation.Text); sql.addprams("@qua", txtqua.Text); sql.addprams("@add", txtaddress.Text); sql.addprams("@phone", txtphone.Text); sql.addprams("@email", txtemail.Text); sql.addprams("@fee", double.Parse(ComboBox1.Text)); sql.addprams("@join", dtp.Value); sql.addprams("@pic", imageT.ImageLocation); sql.ExecProc("exec insert_teacher @name,@gender,@dob,@desig,@qua,@add,@phone,@email,@fee,@join,@pic"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } MessageBox.Show("The details about the teacher is stored", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bnclear_Click(sender, e); ((MainInterface)this.MdiParent).ManageTeacher.bnrefresh_Click(sender, e); this.Close(); }
private void Entermarkss_FormClosed(System.Object sender, System.Windows.Forms.FormClosedEventArgs e) { SqlControl sql = new SqlControl(); sql.ExecSql("delete from marks where marks is null"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } }
public void cls() { sql.ExecSql("select class as [class] ,section as [section] from class"); if (sql.exep != "") { MessageBox.Show(sql.exep, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboclass.Items.Contains(r["class"]) == false) { cboclass.Items.Add(r["class"]); } if (cbostream.Items.Contains(r["section"]) == false) { cbostream.Items.Add(r["section"]); } } }
private void Services_Load(object sender, EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources.gear_icon); Grpdetails.Visible = false; dataGridView1.Visible = false; btndeleteassociation.Visible = false; button1.Visible = false; label3.Visible = false; sql.ExecSql("Select name as [Student],id as [Id] from students"); if (sql.exep != "") { MessageBox.Show(sql.exep); } foreach (DataRow r in sql.data.Tables[0].Rows) { StudentId obj = new StudentId(); obj.ID = (int)r["Id"]; obj.Name = r["Student"].ToString(); cboname.Items.Add(obj); } }
private void bnsubmit_Click(System.Object sender, System.EventArgs e) { if (txtpass.Text == "" | txtrepass.Text == "" | txtsecurity.Text == "" | txtusername.Text == "") { MessageBox.Show("Please fill up The above fields", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txtpass.Text != txtrepass.Text) { MessageBox.Show("Your password and confirmation password does not match", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txtsecurity.Text != "vinu") { MessageBox.Show("Your authentication password does not match", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SqlControl sql = new SqlControl(); sql.addprams("@name", txtusername.Text); sql.ExecSql("select *From users where username =@name"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } if (sql.count != 0) { MessageBox.Show("There is already a user with that name please select a different username!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SqlControl sql1 = new SqlControl(); sql1.addprams("@name", txtfullname.Text); sql1.addprams("@user", txtusername.Text); sql1.addprams("@pass", txtpass.Text); sql1.addprams("@pic", PictureBox1.ImageLocation); sql1.ExecSql("insert into Users(name,pass,picture,username) values(@user,@pass,@pic,@user)"); if (sql1.exep != "") { MessageBox.Show(sql.exep); return; } MessageBox.Show("The new User Details hav been added to the database :)", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtfullname.Clear(); txtpass.Clear(); txtrepass.Clear(); txtsecurity.Clear(); txtusername.Clear(); PictureBox1.Image = null; txtusername.Focus(); ManageUsers_Load(sender, e); }
private void Edits_Load(System.Object sender, System.EventArgs e) { sql.ExecSql("select distinct(class) as [class] from class"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboclass.Items.Contains(r["class"]) == false) { cboclass.Items.Add(r["class"]); } } sql.ExecSql("select distinct(section) as [sec] from class"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cbostream.Items.Contains(r["sec"]) == false) { cbostream.Items.Add(r["sec"]); } } ids = ((MainInterface)this.MdiParent).ManageStudents.StudentIdToEdit; sql.addprams("@id", ids); sql.ExecSql("select * from dbo.show_studing(@id)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } if (sql.count > 0) { txtaddress.Text = sql.data.Tables[0].Rows[0]["address"].ToString(); txtemail.Text = sql.data.Tables[0].Rows[0]["Email"].ToString(); txtname.Text = sql.data.Tables[0].Rows[0]["Student Name"].ToString(); txtphone.Text = sql.data.Tables[0].Rows[0]["Phone Number"].ToString(); cboclass.Text = sql.data.Tables[0].Rows[0]["Class"].ToString(); cbogender.Text = sql.data.Tables[0].Rows[0]["Gender"].ToString(); cbostream.Text = sql.data.Tables[0].Rows[0]["Section"].ToString(); PictureBox1.ImageLocation = sql.data.Tables[0].Rows[0]["pic"].ToString(); } }
private void TeacherDetailedAttendance_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676288_cmyk_04); dtp.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); sql.ExecSql("Select *from teacher"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { if (cboname.Items.Contains(sql.data.Tables[0].Rows[j - 1]["name"]) == false) { cboname.Items.Add(sql.data.Tables[0].Rows[j - 1]["name"]); } } this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676288_cmyk_04); }
private void txtsearch_KeyUp(System.Object sender, System.Windows.Forms.KeyEventArgs e) { SqlControl sql = new SqlControl(); sql.addprams("@name", txtsearch.Text); sql.ExecSql("Select * from dbo.show_fee(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
private void Entermarkss_Load(System.Object sender, System.EventArgs e) { SqlControl sql = new SqlControl(); this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676723_Test_paper_24); sql.ExecSql("select name as [dash] from students"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboname.Items.Contains(r["dash"]) == false) { cboname.Items.Add(r["dash"]); } } sql.ExecSql("select name as [lol] from sub"); foreach (DataRow r in sql.data.Tables[0].Rows) { if (cbosub.Items.Contains(r["lol"]) == false) { cbosub.Items.Add(r["lol"]); } } dtp.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); }
private void dates() { ListBox1.Items.Clear(); SqlControl sql = new SqlControl(); sql.addprams("@name", lblnames.Text); sql.addprams("@date", dtp.Value.Month); sql.ExecSql("select *from dbo.get_dates(@name,@date)"); var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { ListBox1.Items.Add(sql.data.Tables[0].Rows[0]["dates"].ToString()); } }
private void Button1_Click(object sender, EventArgs e) { if (txtserviceamount.Text == "" || txtservicename.Text == "") { MessageBox.Show("Please fill all the fields", "Fields Empty", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } sql.addprams("@name", txtservicename.Text); sql.addprams("@recur", cbofreq.SelectedIndex + 1); sql.addprams("@amount", double.Parse(txtserviceamount.Text)); sql.ExecSql("insert into services(name,recur,amount) values(@name,@recur,@amount)"); MessageBox.Show("Service Added Succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ((MainInterface)this.MdiParent).ManageServices.ManageServices_Load(sender, e); this.Close(); }
private void feesda_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676753_vector_65_04); SqlControl sql = new SqlControl(); sql.addprams("@name", txtsearch.Text); sql.ExecSql("Select * from dbo.show_fee(@name)"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
private void ManageUsers_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676551_add_user); SqlControl sql = new SqlControl(); sql.ExecSql("Select username from users order by username asc"); lstusernames.Items.Clear(); if (sql.count != 0) { var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { lstusernames.Items.Add(sql.data.Tables[0].Rows[j - 1]["username"]); } } }
public void ManageStudents_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676203_graduation); sql.ExecSql("select * from dbo.show_stud()"); if (sql.exep != "") { MessageBox.Show(sql.exep); } bind.DataSource = sql.data.Tables[0]; DataGridView1.DataSource = bind; }
public void saves(System.Object sender, System.EventArgs e) { SqlControl sqls = new SqlControl(); sqls.ExecSql("select * from teacher"); if (sqls.exep != "") { MessageBox.Show(sqls.exep); return; } int num = 1; var loopTo = sqls.count; for (var j = 1; j <= loopTo; j++) { if (pan.Controls["Combos" + num.ToString()].Text == "") { MessageBox.Show("You cannot leave a field blank", "Fill all up", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } num += 1; } num = 1; var loopTo1 = sqls.count; for (var j = 1; j <= loopTo1; j++) { SqlControl sql = new SqlControl(); sql.addprams("@name", sqls.data.Tables[0].Rows[j - 1]["name"]); sql.addprams("@date", dtp.Value); ComboBox combo = new ComboBox(); combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; sql.addprams("@at", combo.SelectedIndex + 1); sql.ExecProc("exec insert_Tat @name,@date,@at"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } num += 1; } see(); }
private void Txtdue_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { SqlControl sql = new SqlControl(); sql.addprams("@name", cboname.Text); sql.addprams("@due", double.Parse(txtdue.Text)); sql.ExecSql("update students set due = @due where name = @name"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } txtdue.Visible = false; lbldue.Visible = true; Cboname_SelectedIndexChanged(sender, e); } }
public void saves(System.Object sender, System.EventArgs e) { if (cboclass.Text != "" & cbosection.Text != "") { SqlControl sql = new SqlControl(); sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } int num = 1; var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { if (pan.Controls["Combos" + num.ToString()].Text == "") { MessageBox.Show("You cannot leave a field blank", "Fill all up", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } num += 1; } num = 1; var loopTo1 = sql.count; for (var j = 1; j <= loopTo1; j++) { SqlControl sql1 = new SqlControl(); sql1.addprams("@name", pan.Controls["Names" + num.ToString()].Text); sql1.addprams("@date", dtp.Value); ComboBox combo = (ComboBox)pan.Controls["Combos" + num.ToString()]; sql1.addprams("@at", combo.SelectedIndex + 1); sql1.ExecProc("exec insert_at @name,@date,@at"); if (sql1.exep != "") { MessageBox.Show(sql1.exep); return; } num += 1; } see(); } }
private void FeesStructures_Load(System.Object sender, System.EventArgs e) { this.Icon = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676753_vector_65_04); Grpdetails.Visible = false; SqlControl sql = new SqlControl(); sql.ExecSql("Select name as [Student] from students"); if (sql.exep != "") { MessageBox.Show(sql.exep); } foreach (DataRow r in sql.data.Tables[0].Rows) { if (cboname.Items.Contains(r["Student"]) == false) { cboname.Items.Add(r["Student"]); } } }
public void clicky(System.Object sender, System.EventArgs e) { if (cboclass.Text != "" & cbosection.Text != "") { SqlControl sql = new SqlControl(); sql.addprams("@class", cboclass.Text); sql.addprams("@section", cbosection.Text); sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc"); if (sql.exep != "") { MessageBox.Show(sql.exep); return; } int num = 1; var loopTo = sql.count; for (var j = 1; j <= loopTo; j++) { if (sender == pan.Controls["Names" + num.ToString()]) { SqlControl sql1 = new SqlControl(); sql1.addprams("@class", cboclass.Text); sql1.addprams("@section", cbosection.Text); sql1.addprams("@name", pan.Controls["Names" + num.ToString()].Text); sql1.ExecSql("select * from dbo.show_atclassname(@class,@section,@name)"); PictureBox1.ImageLocation = sql1.data.Tables[0].Rows[0]["pic"].ToString(); lblnames.Text = sql1.data.Tables[0].Rows[0]["name"].ToString(); lblgender.Text = sql1.data.Tables[0].Rows[0]["gender"].ToString(); lblclass.Text = sql1.data.Tables[0].Rows[0]["class"].ToString(); lblsection.Text = sql1.data.Tables[0].Rows[0]["section"].ToString(); lblnoholidays.Text = sql1.data.Tables[0].Rows[0]["leaves"].ToString(); dates(); } num += 1; } grphidden.Visible = false; grpbox.Visible = true; } else { MessageBox.Show("You must not leave class and section empty", "Fill Up", MessageBoxButtons.OK, MessageBoxIcon.Error); } }