07-05-2011, 02:59 PM
Admission Details.cs
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace SchoolManagementSystem
{
public partial class Reports : Form
{
OleDbConnection con = new OleDbConnection(ConnectionStringForSMS.MyConnectionString());
string var;
int var1;
private bool nonNumberEntered = false;
public Reports()
{
InitializeComponent();
}
private void Reports_Load(object sender, EventArgs e)
{
panel1.Visible = true;
OleDbDataAdapter da23 = new OleDbDataAdapter("select schooltitle,Address from schooltitle", con);
DataSet ds23 = new DataSet();
da23.Fill(ds23);
string schooltitle = ds23.Tables[0].Rows[0].ItemArray[0].ToString();
string address = ds23.Tables[0].Rows[0].ItemArray[1].ToString();
this.Text = schooltitle + "-Student Admission Details";
label2.Text = "";
label2.Text = schooltitle;
dataGridView1.Visible = false;
textBox1.Focus();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (textBox1.Text.Trim() == "")
{
MessageBox.Show("Enter AdmissionNo", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
dataGridView1.Visible = false;
textBox1.Focus();
}
else
{
dataGridView1.Visible = true;
var = textBox1.Text;
con.Open();
OleDbDataAdapter adpt = new OleDbDataAdapter("SELECT A.AdmissionNo,A.AdmisssionDate,A.StudentName,A.FatherName,A.Medium,CC.ClassName as PresentClass,S.[Section],A.FirstName,A.MiddleName,A.SurName,A.DateofBirth,A.Gender,A.ResidentAddress,A.Nationality,A.Pincode,A.Telphone,A.RollNo,A.IsBusTraveller,C.Category,A.OccuFather,A.MotherTongue,A.Religion,CCC.ClassName as AdmisssionClass,A.SchoolCome as PreviousSchool,A.PreviousTC,A.SmallPox,A.PerIdentification from Admission A,Class CC,Class CCC,[Section] S,Category C where A.CategoryID=C.CategoryID and A.SectionID=S.SectionID and A.ClassID=CC.ClassID and A.ClassIDOnAdmission=CCC.ClassID and A.AdmissionNo='" + var + "' ", con);
DataSet ds = new DataSet();
adpt.Fill(ds);
panel1.Visible = true;
dataGridView1.DataSource = ds.Tables[0];
con.Close();
}
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
CrystalReportForm cr = new CrystalReportForm(var);
cr.Show();
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
this.Close();
ReportsForm r = new ReportsForm();
r.Show();
}
private void browse_Click(object sender, EventArgs e)
{
BrowseDataGrid bdg = new BrowseDataGrid();
bdg.Show();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
this.Close();
SMSMainForm a = new SMSMainForm();
a.Show();
}
}
}