Professional Documents
Culture Documents
Project My
Project My
Project My
Mainform
Counseling Form
About Us Box
CODING
About Us Box
using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Drawing; System.Windows.Forms; System.Reflection;
namespace Counselling_System { partial class AboutBox1 : Form { public AboutBox1() { InitializeComponent(); // Initialize the AboutBox to display the product information from the assembly information. // Change assembly information settings for your application through either: // - Project->Properties->Application->Assembly Information // - AssemblyInfo.cs this.Text = String.Format("About {0}", AssemblyTitle); this.labelProductName.Text = "Counseling Management System"; this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); this.labelCopyright.Text = "Gurjinder"; this.labelCompanyName.Text = "Friends"; } #region Assembly Attribute Accessors public string AssemblyTitle { get { // Get all Title attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); // If there is at least one Title attribute if (attributes.Length > 0) { // Select the first one AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; // If it is not an empty string, return it if (titleAttribute.Title != "") return titleAttribute.Title; } // If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); } } public string AssemblyVersion { get
{ return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } public string AssemblyDescription { get { // Get all Description attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute ), false); // If there aren't any Description attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Description attribute, return its value return ((AssemblyDescriptionAttribute)attributes[0]).Description; } } public string AssemblyProduct { get { // Get all Product attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); // If there aren't any Product attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Product attribute, return its value return ((AssemblyProductAttribute)attributes[0]).Product; } } public string AssemblyCopyright { get { // Get all Copyright attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); // If there aren't any Copyright attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Copyright attribute, return its value return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; } } public string AssemblyCompany { get { // Get all Company attributes on this assembly object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); // If there aren't any Company attributes, return an empty string if (attributes.Length == 0) return ""; // If there is a Company attribute, return its value return ((AssemblyCompanyAttribute)attributes[0]).Company; }
} #endregion
namespace Counselling_System { public partial class AddInstitute : Form { public AddInstitute() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox1.Focus(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { string icode, iname, icity, gseat, obcseat, scseats, stseats, totalseats; icode = textBox1.Text; iname = textBox2.Text; icity = textBox3.Text; gseat = textBox4.Text; scseats = textBox6.Text; stseats = textBox7.Text; obcseat = textBox5.Text; totalseats = textBox8.Text; if (icode == "" || iname == "" || icity == "" || gseat == "" || scseats == "" || stseats == "" || totalseats == "") { MessageBox.Show("Check the data enter", " Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else {
try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO Institute (institute_code, institute_name, city_name, general_seats, obc_seats, sc_seats, st_seats, total_seats) VALUES ('" + icode + "', '" + iname + "','" + icity + "', '" + gseat + "','" + obcseat + "','" + scseats + "','" + stseats + "','" + totalseats + "') ", UGIcon); cmd.ExecuteNonQuery(); UGIcon.Close(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox1.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } private void AddInstitute_Load(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox1.Focus(); } } }
namespace Counselling_System { public partial class AddStudent : Form { public AddStudent() { InitializeComponent(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear();
textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox1.Focus(); } private void button1_Click(object sender, EventArgs e) { string rno, name, cat, ran, icode, sex, ccode; rno = textBox1.Text; name = textBox2.Text; cat = textBox6.Text; icode = textBox4.Text; sex = textBox7.Text; ccode = textBox5.Text; ran = textBox3.Text; if (rno == "" || name == "" || cat == "" || ran == "" || icode == "" || sex == "" || ccode == "") { MessageBox.Show("Check the data entered", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO student (Roll_No, Name, Category, Rank, Institute_Code, Sex, ccode) VALUES ('" + rno + "', '" + name + "','" + cat + "', '" + ran + "','" + icode + "','" + sex + "','" + ccode + "') ", UGIcon); cmd.ExecuteNonQuery(); UGIcon.Close(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox1.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } private void AddStudent_Load(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox1.Focus(); // TODO: This line of code loads data into the 'cMSDataSet.sex' table. You can move, or remove it, as needed. this.sexTableAdapter.Fill(this.cMSDataSet.sex); // TODO: This line of code loads data into the 'cMSDataSet.category' table. You can move, or remove it, as needed. this.categoryTableAdapter.Fill(this.cMSDataSet.category); }
private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox1.Focus(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } } }
namespace Counselling_System { public partial class CounselingStatus : Form { public CounselingStatus() { InitializeComponent(); } private void CounselingStatus_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'cMSDataSet.Student' table. You can move, or remove it, as needed. this.studentTableAdapter.Fill(this.cMSDataSet.Student); // TODO: This line of code loads data into the 'cMSDataSet.Institute' table. You can move, or remove it, as needed. this.instituteTableAdapter.Fill(this.cMSDataSet.Institute); } } }
namespace Counselling_System { public partial class Delinstitute : Form { public Delinstitute() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string query = textBox1.Text; try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Institute WHERE Institute_Code ='" + query + "'", UGIcon); DataSet ds = new DataSet(); da.Fill(ds, "Institute"); label10.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(0).ToString(); label11.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(1).ToString(); label12.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(2).ToString(); label13.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(3).ToString(); label14.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(4).ToString(); label15.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(5).ToString(); label16.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(6).ToString(); label17.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(7).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button3_Click(object sender, EventArgs e) { string icode = label10.Text; SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("DELETE from institute where institute_code = '" + icode + "'", UGIcon); cmd.ExecuteNonQuery(); UGIcon.Close(); label10.Clear(); label11.Clear(); label12.Clear(); label13.Clear(); label14.Clear(); label15.Clear(); label16.Clear(); label17.Clear(); textBox1.Focus();
namespace Counselling_System { public partial class DelStudent : Form { public DelStudent() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string query = textBox8.Text; try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM student WHERE Roll_no = '" + query + "'", UGIcon); DataSet ds = new DataSet(); da.Fill(ds, "student"); textBox1.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(0).ToString(); textBox2.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(1).ToString(); textBox6.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(2).ToString(); textBox3.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(3).ToString(); textBox4.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(4).ToString(); textBox7.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(5).ToString(); textBox5.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(6).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox8.Focus(); } private void button3_Click(object sender, EventArgs e) { try { string rno = textBox8.Text; SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("DELETE from student where Roll_no = '" + rno + "'", UGIcon); cmd.ExecuteNonQuery(); UGIcon.Close(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox8.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
namespace Counselling_System { public partial class DisplayStats : Form { public DisplayStats() { InitializeComponent(); } private void DisplayStats_Load(object sender, EventArgs e) {
// TODO: This line of code loads data into the 'cMSDataSet1.display' table. You can move, or remove it, as needed. this.displayTableAdapter.Fill(this.cMSDataSet1.display); // TODO: This line of code loads data into the 'cMSDataSet.Total_Seats' table. You can move, or remove it, as needed. this.total_SeatsTableAdapter.Fill(this.cMSDataSet.Total_Seats); } } }
namespace Counselling_System { public partial class EditInstitute : Form { public EditInstitute() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string query = textBox1.Text; try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Institute WHERE Institute_Code ='" + query + "'", UGIcon); DataSet ds = new DataSet(); da.Fill(ds, "Institute"); label10.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(0).ToString(); label11.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(1).ToString(); label12.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(2).ToString(); label13.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(3).ToString(); label14.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(4).ToString(); label15.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(5).ToString(); label16.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(6).ToString(); label17.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(7).ToString(); } catch (Exception ex) {
MessageBox.Show(ex.Message); } } private void button3_Click(object sender, EventArgs e) { try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("update Institute set Institute_Code = '" + label10.Text + "', institute_name = '" + label11.Text + "', city_name = '" + label12.Text + "', general_seats = '" + label13.Text + "', obc_seats = '" + label14.Text + "', sc_seats = '" + label15.Text + "', st_seats = '" + label16.Text + "', total_seats = '" + label17.Text + "' where Institute_Code = '" + textBox1.Text + "' ", UGIcon); cmd.ExecuteNonQuery(); UGIcon.Close(); label10.Clear(); label11.Clear(); label12.Clear(); label13.Clear(); label14.Clear(); label15.Clear(); label16.Clear(); label17.Clear(); label10.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void label11_TextChanged(object sender, EventArgs e) { } private void label12_TextChanged(object sender, EventArgs e) { } private void label17_TextChanged(object sender, EventArgs e) { } private void label16_TextChanged(object sender, EventArgs e) { } private void label15_TextChanged(object sender, EventArgs e) { } private void label14_TextChanged(object sender, EventArgs e) {
} private void label13_TextChanged(object sender, EventArgs e) { } private void label10_TextChanged(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { } private void label25_Click(object sender, EventArgs e) { } private void label24_Click(object sender, EventArgs e) { } private void label23_Click(object sender, EventArgs e) { } private void label22_Click(object sender, EventArgs e) { } private void label21_Click(object sender, EventArgs e) { } private void label20_Click(object sender, EventArgs e) { } private void label19_Click(object sender, EventArgs e) { } private void label18_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void label9_Click(object sender, EventArgs e) { }
private void label8_Click(object sender, EventArgs e) { } private void label7_Click(object sender, EventArgs e) { } private void label6_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void label1_Click(object sender, EventArgs e) { } } }
namespace Counselling_System { public partial class EditStudent : Form { public EditStudent() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) {
string query = textBox8.Text; try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM student WHERE Roll_no = '" + query + "'", UGIcon); DataSet ds = new DataSet(); da.Fill(ds, "student"); textBox1.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(0).ToString(); textBox2.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(1).ToString(); textBox6.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(2).ToString(); textBox3.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(3).ToString(); textBox4.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(4).ToString(); textBox7.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(5).ToString(); textBox5.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(6).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button3_Click(object sender, EventArgs e) { try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("update Student set roll_No = '" + textBox1.Text + "', name = '" + textBox2.Text + "', category = '" + textBox6.Text + "', rank = '" + textBox3.Text + "', Institute_Code = '" + textBox4.Text + "', sex = '" + textBox7.Text + "', ccode = '" + textBox5.Text + "' where Institute_Code = '" + textBox8.Text + "' ", UGIcon); cmd.ExecuteNonQuery(); UGIcon.Close(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox8.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button2_Click(object sender, EventArgs e) {
this.Close(); } } }
LOGIN FORM
using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.Sql; System.Data.SqlClient;
namespace Counselling_System { public partial class Login : Form { public Login() { InitializeComponent(); textBox1.Focus(); } private void button2_Click(object sender, EventArgs e) { this.Dispose(); } private void button1_Click(object sender, EventArgs e) { textBox1.Focus(); if (textBox1.Text == "" && textBox2.Text == "") { MessageBox.Show("No Login Name or Password", "Unidentified Access Attempt", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=cms;Integrated Security=True"; UGIcon.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM login WHERE Luser='" + textBox1.Text + "'", UGIcon); SqlDataReader dr = cmd.ExecuteReader(); string userText = textBox1.Text; string passText = textBox2.Text; while (dr.Read()) { if (passText == dr["Lpassword"].ToString())
{ string role = dr["Lrole"].ToString(); if (role == "admin") { MessageBox.Show("WELCOME ADMINISTRATOR", "WELCOME", MessageBoxButtons.OK, MessageBoxIcon.Information); new mainform().ShowDialog(); this.Dispose(); } else if (role == "mod") { MessageBox.Show("WELCOME MASTER", "WELCOME", MessageBoxButtons.OK, MessageBoxIcon.Information); /* new modForm().ShowDialog(); this.Close(); this.Dispose();*/ break; } else if (role == "user") { MessageBox.Show("WELCOME USER", "WELCOME", MessageBoxButtons.OK, MessageBoxIcon.Information); /*new userform().ShowDialog(); this.Close(); this.Dispose();*/ break; } else { MessageBox.Show("System Busy"); break; } } else { MessageBox.Show("Invalid Login Name or Password", "Unidentified Access Attempt", MessageBoxButtons.OK, MessageBoxIcon.Warning); textBox1.Text = ""; textBox2.Text = ""; textBox1.Focus(); } } dr.Close(); UGIcon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } }
MAIN FORM
namespace Counselling_System { public partial class mainform : Form { public mainform() { InitializeComponent(); } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox1 ab = new AboutBox1(); ab.Show(); } private void newToolStripMenuItem_Click(object sender, EventArgs e) { new AddInstitute().ShowDialog(); } private void searchToolStripMenuItem_Click(object sender, EventArgs e) { new SInstitute().ShowDialog(); } private void editToolStripMenuItem_Click(object sender, EventArgs e) { new EditInstitute().ShowDialog(); } private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { new Delinstitute().ShowDialog(); } private void studentToolStripMenuItem_Click(object sender, EventArgs e) { new AddStudent().ShowDialog(); } private void collegeToolStripMenuItem_Click(object sender, EventArgs e) { new SearchStudent().ShowDialog(); } private void editToolStripMenuItem1_Click(object sender, EventArgs e) { new EditStudent().ShowDialog(); } private void deleteToolStripMenuItem1_Click(object sender, EventArgs e) { new DelStudent().ShowDialog(); } private void statusToolStripMenuItem_Click(object sender, EventArgs e) { }
private void displayToolStripMenuItem_Click(object sender, EventArgs e) { new DisplayStats().Show(); } private void searchToolStripMenuItem1_Click(object sender, EventArgs e) { new CounselingStatus().Show(); } private void displayStatusToolStripMenuItem_Click(object sender, EventArgs e) { new DisplayStats().Show(); } } }
SEARCH STUDENT
using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient; System.Data.Sql;
namespace Counselling_System { public partial class SearchStudent : Form { public SearchStudent() { InitializeComponent(); textBox8.Focus(); } private void SearchStudent_Load(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox8.Focus(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { string query = textBox8.Text; try {
SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM student WHERE Roll_no = '" + query + "'", UGIcon); DataSet ds = new DataSet(); da.Fill(ds, "student"); textBox1.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(0).ToString(); textBox2.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(1).ToString(); textBox6.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(2).ToString(); textBox3.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(3).ToString(); textBox4.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(4).ToString(); textBox7.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(5).ToString(); textBox5.Text = ds.Tables["student"].Rows[0].ItemArray.GetValue(6).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void button2_Click(object sender, EventArgs e) { textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox8.Focus(); } } }
SEARCH INSTITUTE
using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient; System.Data.Sql;
namespace Counselling_System { public partial class SInstitute : Form { public SInstitute() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { string query = textBox1.Text; try { SqlConnection UGIcon = new SqlConnection(); UGIcon.ConnectionString = "Data Source=.;Initial Catalog=CMS;Integrated Security=True"; UGIcon.Open(); SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Institute WHERE Institute_Code ='" + query + "'", UGIcon); DataSet ds = new DataSet(); da.Fill(ds, "Institute"); label10.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(0).ToString(); label11.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(1).ToString(); label12.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(2).ToString(); label13.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(3).ToString(); label14.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(4).ToString(); label15.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(5).ToString(); label16.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(6).ToString(); label17.Text = ds.Tables["Institute"].Rows[0].ItemArray.GetValue(7).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
BIBLOGRAPHY
The following books and websites were used extensively for the project development and implementation. Wrox Internationals programming with C# Daniweb.com Codesourceproject.com