Created
October 8, 2015 18:09
-
-
Save SajjadArifGul/53e53c4b83b1113a4703 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string imageLocation = ""; | |
string cs = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Data\School.mdf;Integrated Security=True"; | |
static SqlConnection con = null; | |
static SqlCommand cmd = null; | |
Regex myRegularExpression = new Regex(" \b[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\b"); | |
public Form1() | |
{ | |
InitializeComponent(); | |
fillCombo2(); | |
Techresult(); | |
} | |
#region Summary_region | |
void DisplaySummary() | |
{ | |
try | |
{ | |
int Total_male_students; | |
int Total_female_students; | |
int Total_male_teachers; | |
int Total_female_teachers; | |
con = new SqlConnection(cs); | |
con.Open(); | |
cmd = new SqlCommand("SELECT COUNT(*) FROM StdStudent WHERE Gender='Male' ", con); | |
Total_male_students = int.Parse(cmd.ExecuteScalar().ToString()); | |
cmd = new SqlCommand("SELECT COUNT(*) FROM StdStudent WHERE Gender='Female' ", con); | |
Total_female_students = int.Parse(cmd.ExecuteScalar().ToString()); | |
cmd = new SqlCommand("SELECT COUNT(*) FROM Teacher WHERE Gender='Male' ", con); | |
Total_male_teachers = int.Parse(cmd.ExecuteScalar().ToString()); | |
cmd = new SqlCommand("SELECT COUNT(*) FROM Teacher WHERE Gender='Female' ", con); | |
Total_female_teachers = int.Parse(cmd.ExecuteScalar().ToString()); | |
this.Tmale.Text = "" + Total_male_teachers.ToString() + ""; | |
this.Tfemale.Text = "" + Total_female_teachers.ToString() + ""; | |
this.Ttotal.Text = "" + (Total_male_teachers + Total_female_teachers).ToString() + ""; | |
this.Smale.Text = "" + Total_male_students.ToString() + ""; | |
this.Sfemale.Text = "" + Total_female_students.ToString() + ""; | |
this.Stotal.Text = "" + (Total_male_students + Total_female_students).ToString() + ""; | |
con.Close(); | |
} | |
catch (System.Exception ex) | |
{ | |
MessageBox.Show(ex.Message); | |
} | |
finally | |
{ | |
if (con.State == ConnectionState.Open) | |
{ | |
con.Close(); | |
} | |
} | |
} | |
#endregion | |
/* Complete code is in the Archived File attcahed */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment