SlideShare a Scribd company logo
DiTec Esoft C# Project Free
DiTec Project Esoft (C#)
Cource: Diploma in Information Technology With E commerce
Obtained Grade B For This Project
Do not direct copy form this project. This project was uploaded to enhance your IT
knowledge.I think this project may be very helpful to understand procedure of C# project
for DiTEC.
Ditec esoft C# project
Ditec esoft C# project
Welcome Start & Window
Enter Button
private void BtnEnter_Click(object sender, EventArgs e)
{
FrmWelcome fr = new FrmWelcome();
fr.Show();
this.Hide();
}
Exit Button
private void BtnExit_Click(object sender, EventArgs e)
{
DialogResult d1;
d1 = MessageBox.Show("Are You Sure Do You Want To Exit
?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (d1.ToString() == "Yes")
{
Application.Exit();
}
}
Welcome & Loading Window
Timer control
private void timer1_Tick(object sender, EventArgs e)
{
if (progressBar1.Value < 100)
{
progressBar1.Value = progressBar1.Value + 2;
}
else
{
timer1.Enabled=false;
FrmUser fr = new FrmUser();
fr.Show();
this.Hide();
}
Timer Properties
Login Window
Submit Button
string username = "kasun";
string password = "8620";
private void button1_Click(object sender, EventArgs e)
{
if (TxtUsername.Text == username && TxtPassword.Text == password)
{
DialogResult m2;
m2 = MessageBox.Show("Thank
You!", "Sucsess",MessageBoxButtons.OK, MessageBoxIcon.Information);
if (m2.ToString() == "OK")
{
MDISystem md1 = new MDISystem();
md1.Show();
this.Hide();
}
}
else
{
DialogResult m2;
m2 = MessageBox.Show("Incorrect Username & Password
","Error!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
if (m2.ToString() == "Retry")
{
TxtUsername.Clear();
TxtPassword.Clear();
TxtUsername.Focus();
Clear Button
TxtUsername.Text = "";
TxtPassword.Text = "";
TxtUsername.Focus();
Exit Button
DialogResult d1;
d1 = MessageBox.Show("Are You Sure Do You Want To Exit
?","Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (d1.ToString() == "Yes")
{
Application.Exit();
}
MDI Window (Inside Menu Bar)
Appointment Details Window
FrmAppoinment_Details frm = new FrmAppoinment_Details();
frm.MdiParent = this;
frm.Show();
Medical Details Window
FrmMedical_Detals frm= new FrmMedical_Detals();
frm.MdiParent = this;
frm.Show();
Patient Details Window
FrmPatient_Details frm = new FrmPatient_Details();
frm.MdiParent = this;
frm.Show();
Doctor Details Window
FrmDoctor frm = new FrmDoctor();
frm.MdiParent = this;
frm.Show();
Medical Packages Window
FrmDoctor frm = new FrmDoctor();
frm.MdiParent = this;
frm.Show();
Help Window
FrmHelp frm = new FrmHelp();
frm.MdiParent = this;
frm.Show();
Author Window
FrmAuthor frm = new FrmAuthor();
frm.MdiParent = this;
frm.Show();
Appointment Details Window
Add Button
string connectionstring,commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring="INSERT INTO app
VALUES('"+CboRef.Text+"','"+txtpatname.Text+"','"+txtcontact.Text+"','"+txtad
dress.Text+"','"+cbogender.Text+"','"+comboBox1.Text+"','"+txtamount.Text+"')
";
MessageBox.Show("OK","Add Data ?",MessageBoxButtons.OK,MessageBoxIcon.Error);
OleDbConnection conn=new OleDbConnection(connectionstring);
OleDbCommand comm=new OleDbCommand(commandstring,conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Click OK","Data Added Successfully",MessageBoxButtons.OK);
conn.Close();
Search Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "SELECT*FROM app WHERE rn='" + CboRef.Text + "'";
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
OleDbDataReader reader=null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show("Completed !"); }
reader = comm.ExecuteReader();
while (reader.Read())
{
txtpatname.Text = reader[1].ToString();
txtcontact.Text = reader[2].ToString();
txtaddress.Text = reader[3].ToString();
cbogender.Text = reader[4].ToString();
comboBox1.Text = reader[5].ToString();
txtamount.Text = reader[6].ToString();
}
reader.Close();
Update Button
String connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "UPDATE app SET rn='" + CboRef.Text +"',pn='" +
txtpatname.Text + "',co='" + txtcontact.Text + "',ad='" + txtaddress.Text
+ "',gn='" + cbogender.Text + "',pt='" + comboBox1.Text + "',am='" +
txtamount.Text + "'";
MessageBox.Show("Are u Sure", "Do You Want Update
?",MessageBoxButtons.OK, MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Success", "Data Added
Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error);
conn.Close();
Clear Button
CboRef.Text = "";
txtpatname.Text = "";
txtcontact.Text = "";
txtaddress.Text = "";
cbogender.Text = "";
comboBox1.Text = "";
txtamount.Text = "";
Delete Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "DELETE*FROM app WHERE rn='"+CboRef.Text+ "'";
if (MessageBox.Show("Are You Sure Do You Want Delete This Record
?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Deleted Successfully");
CboRef.Text = "";
txtpatname.Clear();
txtcontact.Clear();
txtaddress.Clear();
cbogender.Text = "";
comboBox1.Text = "";
txtamount.Clear();
conn.Close();
Exit Button
this.Hide();
Medical Details Window
Add Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "INSERT INTO medical VALUES('" + comboBox1.Text
+ "','" + textBox3.Text + "','" + textBox2.Text +"','" + textBox1.Text
+ "','" + comboBox2.Text + "')";
MessageBox.Show("OK", "Add Data
?", MessageBoxButtons.OK,MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Click OK", "Data Added
Successfully",MessageBoxButtons.OK);
conn.Close();
Search Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "SELECT*FROM medical WHERE pno='" +
comboBox1.Text + "'";
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
OleDbDataReader reader = null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show("Completed !"); }
reader = comm.ExecuteReader();
while (reader.Read())
{
textBox3.Text = reader[1].ToString();
textBox2.Text = reader[2].ToString();
textBox1.Text = reader[3].ToString();
comboBox2.Text = reader[4].ToString();
}
reader.Close();
Update Button
String connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "UPDATE medical SET pno='" + comboBox1.Text
+ "',pn='" + textBox3.Text + "',q='" + textBox2.Text +"',pp='" +
textBox1.Text + "',de='" + comboBox2.Text + "'";
MessageBox.Show("Are u Sure", "Do You Want Update
?",MessageBoxButtons.OK, MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Success", "Data Added
Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error);
conn.Close();
Clear Button
comboBox1.Text = "";
textBox3.Text = "";
textBox2.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
Delete Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "DELETE*FROM medical WHERE pno='" +
comboBox1.Text + "'";
if (MessageBox.Show("Are You Sure Do You Want Delete This Record
?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Deleted Successfully");
textBox3.Clear();
textBox2.Clear();
textBox1.Clear();
comboBox2.Text = "";
comboBox1.Text = "";
conn.Close();
Exit Button
this.Hide();
Patient Details Window
Add Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "INSERT INTO patient VALUES('" + comboBox1.Text
+ "','" + textBox1.Text + "','" + comboBox2.Text +"','" + textBox2.Text
+ "','" + textBox3.Text + "','" + textBox4.Text + "')";
MessageBox.Show("OK", "Add Data
?",MessageBoxButtons.OK, MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Click OK", "Data Added
Successfully",MessageBoxButtons.OK);
conn.Close();
Search Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "SELECT*FROM patient WHERE pno='" +
comboBox1.Text + "'";
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
OleDbDataReader reader = null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show("Completed !"); }
reader = comm.ExecuteReader();
while (reader.Read())
{
textBox1.Text = reader[1].ToString();
comboBox2.Text = reader[2].ToString();
textBox2.Text = reader[3].ToString();
textBox3.Text = reader[4].ToString();
textBox4.Text = reader[5].ToString();
}
reader.Close();
Update Button
String connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "UPDATE patient SET pno='" + comboBox1.Text
+ "',pn='" + textBox1.Text + "',db='" + comboBox2.Text + "',bg='" +
textBox2.Text + "',da='" + textBox3.Text + "',dr='" + textBox4.Text + "'";
MessageBox.Show("Are u Sure", "Do You Want Update
?",MessageBoxButtons.OK, MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Success", "Data Added
Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error);
conn.Close();
Clear Button
comboBox1.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
Delete Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "DELETE*FROM patient WHERE pno='" +
comboBox1.Text + "'";
if (MessageBox.Show("Are You Sure Do You Want Delete This Record
?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Deleted Successfully");
comboBox1.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
textBox2.Clear();
textBox3.Clear();
textBox4.Text = "";
Exit Button
this.Hide();
Doctor Details Window
Add Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "INSERT INTO patient VALUES('" + comboBox1.Text
+ "','" + textBox1.Text + "','" + comboBox2.Text +"','" + textBox2.Text
+ "','" + textBox3.Text + "','" + textBox4.Text + "')";
MessageBox.Show("OK", "Add Data
?", MessageBoxButtons.OK,MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Click OK", "Data Added
Successfully",MessageBoxButtons.OK);
conn.Close();
Search Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "SELECT*FROM patient WHERE pno='" +
comboBox1.Text + "'";
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
OleDbDataReader reader = null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show("Completed !"); }
reader = comm.ExecuteReader();
while (reader.Read())
{
textBox1.Text = reader[1].ToString();
comboBox2.Text = reader[2].ToString();
textBox2.Text = reader[3].ToString();
textBox3.Text = reader[4].ToString();
textBox4.Text = reader[5].ToString();
}
reader.Close();
Update Button
String connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "UPDATE patient SET pno='" + comboBox1.Text
+ "',pn='" + textBox1.Text + "',db='" + comboBox2.Text + "',bg='" +
textBox2.Text + "',da='" + textBox3.Text + "',dr='" + textBox4.Text + "'";
MessageBox.Show("Are u Sure", "Do You Want Update
?",MessageBoxButtons.OK, MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Success", "Data Added
Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error);
conn.Close();
Exit Button
this.Hide();
Delete Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "DELETE*FROM patient WHERE pno='" +
comboBox1.Text + "'";
if (MessageBox.Show("Are You Sure Do You Want Delete This Record
?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Deleted Successfully");
comboBox1.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
textBox2.Clear();
textBox3.Clear();
textBox4.Text = "";
Clear Button
comboBox1.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
Medical Packages Window
Add Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "INSERT INTO patient VALUES('" + comboBox1.Text
+ "','" + textBox1.Text + "','" + comboBox2.Text +"','" + textBox2.Text
+ "','" + textBox3.Text + "','" + textBox4.Text + "')";
MessageBox.Show("OK", "Add Data
?", MessageBoxButtons.OK,MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Click OK", "Data Added
Successfully",MessageBoxButtons.OK);
conn.Close();
Search Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "SELECT*FROM patient WHERE pno='" +
comboBox1.Text + "'";
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
OleDbDataReader reader = null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show("Completed !"); }
reader = comm.ExecuteReader();
while (reader.Read())
{
textBox1.Text = reader[1].ToString();
comboBox2.Text = reader[2].ToString();
textBox2.Text = reader[3].ToString();
textBox3.Text = reader[4].ToString();
textBox4.Text = reader[5].ToString();
}
reader.Close();
Update Button
String connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "UPDATE patient SET pno='" + comboBox1.Text
+ "',pn='" + textBox1.Text + "',db='" + comboBox2.Text + "',bg='" +
textBox2.Text + "',da='" + textBox3.Text + "',dr='" + textBox4.Text + "'";
MessageBox.Show("Are u Sure", "Do You Want Update
?",MessageBoxButtons.OK, MessageBoxIcon.Error);
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Success", "Data Added
Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error);
conn.Close();
Clear Button
comboBox1.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
Delete Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "DELETE*FROM patient WHERE pno='" +
comboBox1.Text + "'";
if (MessageBox.Show("Are You Sure Do You Want Delete This Record
?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Deleted Successfully");
comboBox1.Text = "";
textBox1.Text = "";
comboBox2.Text = "";
textBox2.Clear();
textBox3.Clear();
textBox4.Text = "";
Exit Button
this.Hide();
Help Window
Select Button
string connectionstring, commandstring;
connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:Hosptal Management Systemesoft.mdb";
commandstring = "SELECT*FROM help WHERE se='" + comboBox1.Text
+ "'";
OleDbConnection conn = newOleDbConnection(connectionstring);
OleDbCommand comm = new OleDbCommand(commandstring, conn);
OleDbDataReader reader = null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show("......"); }
reader = comm.ExecuteReader();
while (reader.Read())
{
textBox2.Text = reader[1].ToString();
}
reader.Close();
Exit Button
this.Hide();
Author Window
Exit Button
this.Hide();
Now I think you earned good knowledge about project . Now I hope to give you additional
codes to solve some problems. ( These are additional codes )
privatevoid btnadd_Click(object sender, EventArgs e)
{
string connectionString, commandString;
connectionString
=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital
SystemHMS.mdb";
commandString = "INSERT INTO Appoinment VALUES ('"+
cborefno.Text + "','" + txtpatname.Text + "','" + txtcontact.Text
+ "','" + txtaddress.Text + "','" + cbogender.Text + "','" +
cboPayment.Text + "','" + txtamount.Text + "')";
OleDbConnection conn = newOleDbConnection(connectionString);
OleDbCommand comm = newOleDbCommand(commandString, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Added Succesfully");
cborefno.Items.Add(cborefno.Text);
Clear();
cborefno.Focus();
conn.Close();
}
privatevoid cborefno_SelectedIndexChanged(object sender,EventArgs e
)
{
string connectionString, commandString;
connectionString
=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital
SystemHMS.mdb";
commandString = "SELECT * FROM Appoinment WHERE
RefNo='" + cborefno.Text + "'";
OleDbConnection conn = newOleDbConnection(connectionString);
OleDbCommand comm = newOleDbCommand(commandString, conn);
OleDbDataReader reader = null;
try
{ conn.Open(); }
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
reader = comm.ExecuteReader();
while (reader.Read())
{
txtpatname.Text = reader[1].ToString();
txtcontact.Text = reader[2].ToString();
txtaddress.Text = reader[3].ToString();
cbogender.Text = reader[4].ToString();
cboPayment.Text = reader[5].ToString();
txtamount.Text = reader[6].ToString(); }
reader.Close();
conn.Close();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
string connectionString, commandString;
connectionString
=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital
SystemHMS.mdb";
commandString = "SELECT RefNo FROM Appoinment";
OleDbConnection conn = newOleDbConnection(connectionString);
OleDbCommand comm = newOleDbCommand(commandString, conn);
OleDbDataReader reader = null;
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
reader = comm.ExecuteReader();
while (reader.Read())
{
cborefno.Items.Add(reader[0]);
}
reader.Close();
conn.Close();
}
privatevoid btnupdate_Click(object sender, EventArgs e)
{
string connectionString, commandString;
connectionString
=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital
SystemHMS.mdb";
commandString = "UPDATE Appoinment SET PatName = '"+
txtpatname.Text + "', Contact = '" + txtcontact.Text + "', Address
= '" + txtaddress.Text + "', Gender = '" + cbogender.Text
+ "',PayType = '" + cboPayment.Text +"',Amount='" + txtamount.Text
+ "' where RefNo = '" + cborefno.Text + "'";
if (MessageBox.Show("Are you sure, you want to Update this
record?", "Sure?", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionString);
OleDbCommand comm = newOleDbCommand(commandString, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Updated Succesfully");
Clear();
cborefno.Focus();
conn.Close();
}
privatevoid btndelete_Click(object sender, EventArgs e)
{
string connectionString, commandString;
connectionString
=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital
SystemHMS.mdb";
commandString = "DELETE Appoinment.RefNo FROM
Appoinment where Appoinment.RefNo = '" + cborefno.Text + "'";
if (MessageBox.Show("Are you sure, you want to delete this
record?", "Sure?", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
OleDbConnection conn = newOleDbConnection(connectionString);
OleDbCommand comm = newOleDbCommand(commandString, conn);
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record Deleted Successfully");
conn.Close();
cborefno.Items.Remove(cborefno.Text);
cborefno.Focus();
Clear();
}
privatevoid Clear()
{
cborefno.Text = "";
txtpatname.Clear();
txtcontact.Clear();
txtaddress.Clear();
cbogender.Text = "";
cboPayment.Text = "";
txtamount.Clear();
cborefno.Focus();
}
privatevoid btnclear_Click(object sender, EventArgs e)
{
Clear();
}
privatevoid btnexit_Click(object sender, EventArgs e)
{
this.Hide();
}
********************************
About Me !
********************************
Kasun Madhusanka
Phone:+94770597830
Email:kktmadhusanka@gmail.com
To Make likes me on facebook click below link
https://www.facebook.com/KKTMadhusanka
To make connection with me !
https://www.linkedin.com/in/kktmadhusanka
Posted by Kasun Madhusanka at 3:44 PM

More Related Content

Similar to Ditec esoft C# project (20)

DOCX
Employee management system report
Prince Singh
 
DOCX
Cis 407 i lab 5 of 7
helpido9
 
DOC
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
 
DOCX
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
abhi353063
 
PPTX
76.pptx ajx ppt file for univercity of granted
hectortrading693
 
DOC
Cis407 a ilab 4 web application development devry university
lhkslkdh89009
 
DOC
Cis407 a ilab 5 web application development devry university
lhkslkdh89009
 
DOC
Cis407 a ilab 3 web application development devry university
lhkslkdh89009
 
DOCX
Cis 407 i lab 4 of 7
helpido9
 
PDF
Kupdf.com 292609858 computer-science-c-project-on-hospital-management-system-...
Manjeet Maan
 
PPTX
37c
Sireesh K
 
PPS
VISUAL BASIC .net data accesss vii
argusacademy
 
DOC
Open microsoft visual studio/tutorialoutlet
Mitchinson
 
DOCX
Docimp
KaivanShah30
 
TXT
Vb database connections
Tharsikan
 
PDF
Sistema de ventas
DAYANA RETO
 
PDF
Sistemadeventas 100707084319-phpapp01
mafv1976
 
DOCX
Soa lab
Prianka Padmanaban
 
PDF
VB net lab.pdf
Prof. Dr. K. Adisesha
 
DOCX
Machine problems
nivlayalat
 
Employee management system report
Prince Singh
 
Cis 407 i lab 5 of 7
helpido9
 
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
 
This is part 1 of 3STEP 1 Modify the clsDataLayer to Use a Two-St.docx
abhi353063
 
76.pptx ajx ppt file for univercity of granted
hectortrading693
 
Cis407 a ilab 4 web application development devry university
lhkslkdh89009
 
Cis407 a ilab 5 web application development devry university
lhkslkdh89009
 
Cis407 a ilab 3 web application development devry university
lhkslkdh89009
 
Cis 407 i lab 4 of 7
helpido9
 
Kupdf.com 292609858 computer-science-c-project-on-hospital-management-system-...
Manjeet Maan
 
VISUAL BASIC .net data accesss vii
argusacademy
 
Open microsoft visual studio/tutorialoutlet
Mitchinson
 
Docimp
KaivanShah30
 
Vb database connections
Tharsikan
 
Sistema de ventas
DAYANA RETO
 
Sistemadeventas 100707084319-phpapp01
mafv1976
 
VB net lab.pdf
Prof. Dr. K. Adisesha
 
Machine problems
nivlayalat
 

Recently uploaded (20)

PDF
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
community health nursing question paper 2.pdf
Prince kumar
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Dimensions of Societal Planning in Commonism
StefanMz
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Ad

Ditec esoft C# project

  • 1. DiTec Esoft C# Project Free DiTec Project Esoft (C#) Cource: Diploma in Information Technology With E commerce Obtained Grade B For This Project Do not direct copy form this project. This project was uploaded to enhance your IT knowledge.I think this project may be very helpful to understand procedure of C# project for DiTEC.
  • 4. Welcome Start & Window Enter Button private void BtnEnter_Click(object sender, EventArgs e) { FrmWelcome fr = new FrmWelcome(); fr.Show(); this.Hide();
  • 5. } Exit Button private void BtnExit_Click(object sender, EventArgs e) { DialogResult d1; d1 = MessageBox.Show("Are You Sure Do You Want To Exit ?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (d1.ToString() == "Yes") { Application.Exit(); } } Welcome & Loading Window Timer control private void timer1_Tick(object sender, EventArgs e) { if (progressBar1.Value < 100) { progressBar1.Value = progressBar1.Value + 2; } else { timer1.Enabled=false; FrmUser fr = new FrmUser(); fr.Show(); this.Hide(); } Timer Properties
  • 6. Login Window Submit Button string username = "kasun"; string password = "8620"; private void button1_Click(object sender, EventArgs e) { if (TxtUsername.Text == username && TxtPassword.Text == password) { DialogResult m2; m2 = MessageBox.Show("Thank You!", "Sucsess",MessageBoxButtons.OK, MessageBoxIcon.Information); if (m2.ToString() == "OK") { MDISystem md1 = new MDISystem(); md1.Show(); this.Hide(); } }
  • 7. else { DialogResult m2; m2 = MessageBox.Show("Incorrect Username & Password ","Error!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (m2.ToString() == "Retry") { TxtUsername.Clear(); TxtPassword.Clear(); TxtUsername.Focus(); Clear Button TxtUsername.Text = ""; TxtPassword.Text = ""; TxtUsername.Focus(); Exit Button DialogResult d1; d1 = MessageBox.Show("Are You Sure Do You Want To Exit ?","Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (d1.ToString() == "Yes") { Application.Exit(); } MDI Window (Inside Menu Bar) Appointment Details Window FrmAppoinment_Details frm = new FrmAppoinment_Details(); frm.MdiParent = this; frm.Show(); Medical Details Window FrmMedical_Detals frm= new FrmMedical_Detals(); frm.MdiParent = this; frm.Show(); Patient Details Window FrmPatient_Details frm = new FrmPatient_Details(); frm.MdiParent = this; frm.Show(); Doctor Details Window
  • 8. FrmDoctor frm = new FrmDoctor(); frm.MdiParent = this; frm.Show(); Medical Packages Window FrmDoctor frm = new FrmDoctor(); frm.MdiParent = this; frm.Show(); Help Window FrmHelp frm = new FrmHelp(); frm.MdiParent = this; frm.Show(); Author Window FrmAuthor frm = new FrmAuthor(); frm.MdiParent = this; frm.Show(); Appointment Details Window Add Button string connectionstring,commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring="INSERT INTO app VALUES('"+CboRef.Text+"','"+txtpatname.Text+"','"+txtcontact.Text+"','"+txtad dress.Text+"','"+cbogender.Text+"','"+comboBox1.Text+"','"+txtamount.Text+"') "; MessageBox.Show("OK","Add Data ?",MessageBoxButtons.OK,MessageBoxIcon.Error); OleDbConnection conn=new OleDbConnection(connectionstring); OleDbCommand comm=new OleDbCommand(commandstring,conn);
  • 9. conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Click OK","Data Added Successfully",MessageBoxButtons.OK); conn.Close(); Search Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "SELECT*FROM app WHERE rn='" + CboRef.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); OleDbDataReader reader=null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("Completed !"); } reader = comm.ExecuteReader(); while (reader.Read()) { txtpatname.Text = reader[1].ToString(); txtcontact.Text = reader[2].ToString(); txtaddress.Text = reader[3].ToString(); cbogender.Text = reader[4].ToString(); comboBox1.Text = reader[5].ToString(); txtamount.Text = reader[6].ToString(); } reader.Close(); Update Button String connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "UPDATE app SET rn='" + CboRef.Text +"',pn='" + txtpatname.Text + "',co='" + txtcontact.Text + "',ad='" + txtaddress.Text + "',gn='" + cbogender.Text + "',pt='" + comboBox1.Text + "',am='" + txtamount.Text + "'"; MessageBox.Show("Are u Sure", "Do You Want Update ?",MessageBoxButtons.OK, MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Success", "Data Added Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error); conn.Close(); Clear Button CboRef.Text = ""; txtpatname.Text = "";
  • 10. txtcontact.Text = ""; txtaddress.Text = ""; cbogender.Text = ""; comboBox1.Text = ""; txtamount.Text = ""; Delete Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "DELETE*FROM app WHERE rn='"+CboRef.Text+ "'"; if (MessageBox.Show("Are You Sure Do You Want Delete This Record ?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Deleted Successfully"); CboRef.Text = ""; txtpatname.Clear(); txtcontact.Clear(); txtaddress.Clear(); cbogender.Text = ""; comboBox1.Text = ""; txtamount.Clear(); conn.Close(); Exit Button this.Hide(); Medical Details Window
  • 11. Add Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "INSERT INTO medical VALUES('" + comboBox1.Text + "','" + textBox3.Text + "','" + textBox2.Text +"','" + textBox1.Text + "','" + comboBox2.Text + "')"; MessageBox.Show("OK", "Add Data ?", MessageBoxButtons.OK,MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Click OK", "Data Added Successfully",MessageBoxButtons.OK); conn.Close(); Search Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "SELECT*FROM medical WHERE pno='" + comboBox1.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("Completed !"); } reader = comm.ExecuteReader();
  • 12. while (reader.Read()) { textBox3.Text = reader[1].ToString(); textBox2.Text = reader[2].ToString(); textBox1.Text = reader[3].ToString(); comboBox2.Text = reader[4].ToString(); } reader.Close(); Update Button String connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "UPDATE medical SET pno='" + comboBox1.Text + "',pn='" + textBox3.Text + "',q='" + textBox2.Text +"',pp='" + textBox1.Text + "',de='" + comboBox2.Text + "'"; MessageBox.Show("Are u Sure", "Do You Want Update ?",MessageBoxButtons.OK, MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Success", "Data Added Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error); conn.Close(); Clear Button comboBox1.Text = ""; textBox3.Text = ""; textBox2.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; Delete Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "DELETE*FROM medical WHERE pno='" + comboBox1.Text + "'"; if (MessageBox.Show("Are You Sure Do You Want Delete This Record ?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open();
  • 13. comm.ExecuteNonQuery(); MessageBox.Show("Record Deleted Successfully"); textBox3.Clear(); textBox2.Clear(); textBox1.Clear(); comboBox2.Text = ""; comboBox1.Text = ""; conn.Close(); Exit Button this.Hide(); Patient Details Window Add Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "INSERT INTO patient VALUES('" + comboBox1.Text + "','" + textBox1.Text + "','" + comboBox2.Text +"','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; MessageBox.Show("OK", "Add Data ?",MessageBoxButtons.OK, MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open();
  • 14. comm.ExecuteNonQuery(); MessageBox.Show("Click OK", "Data Added Successfully",MessageBoxButtons.OK); conn.Close(); Search Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "SELECT*FROM patient WHERE pno='" + comboBox1.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("Completed !"); } reader = comm.ExecuteReader(); while (reader.Read()) { textBox1.Text = reader[1].ToString(); comboBox2.Text = reader[2].ToString(); textBox2.Text = reader[3].ToString(); textBox3.Text = reader[4].ToString(); textBox4.Text = reader[5].ToString(); } reader.Close(); Update Button String connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "UPDATE patient SET pno='" + comboBox1.Text + "',pn='" + textBox1.Text + "',db='" + comboBox2.Text + "',bg='" + textBox2.Text + "',da='" + textBox3.Text + "',dr='" + textBox4.Text + "'"; MessageBox.Show("Are u Sure", "Do You Want Update ?",MessageBoxButtons.OK, MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Success", "Data Added Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error); conn.Close(); Clear Button comboBox1.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = "";
  • 15. Delete Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "DELETE*FROM patient WHERE pno='" + comboBox1.Text + "'"; if (MessageBox.Show("Are You Sure Do You Want Delete This Record ?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Deleted Successfully"); comboBox1.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; textBox2.Clear(); textBox3.Clear(); textBox4.Text = ""; Exit Button this.Hide(); Doctor Details Window
  • 16. Add Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "INSERT INTO patient VALUES('" + comboBox1.Text + "','" + textBox1.Text + "','" + comboBox2.Text +"','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; MessageBox.Show("OK", "Add Data ?", MessageBoxButtons.OK,MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Click OK", "Data Added Successfully",MessageBoxButtons.OK); conn.Close(); Search Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "SELECT*FROM patient WHERE pno='" + comboBox1.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("Completed !"); } reader = comm.ExecuteReader(); while (reader.Read()) { textBox1.Text = reader[1].ToString(); comboBox2.Text = reader[2].ToString(); textBox2.Text = reader[3].ToString(); textBox3.Text = reader[4].ToString(); textBox4.Text = reader[5].ToString(); } reader.Close(); Update Button String connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb";
  • 17. commandstring = "UPDATE patient SET pno='" + comboBox1.Text + "',pn='" + textBox1.Text + "',db='" + comboBox2.Text + "',bg='" + textBox2.Text + "',da='" + textBox3.Text + "',dr='" + textBox4.Text + "'"; MessageBox.Show("Are u Sure", "Do You Want Update ?",MessageBoxButtons.OK, MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Success", "Data Added Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error); conn.Close(); Exit Button this.Hide(); Delete Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "DELETE*FROM patient WHERE pno='" + comboBox1.Text + "'"; if (MessageBox.Show("Are You Sure Do You Want Delete This Record ?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Deleted Successfully"); comboBox1.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; textBox2.Clear(); textBox3.Clear(); textBox4.Text = ""; Clear Button comboBox1.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; Medical Packages Window
  • 18. Add Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "INSERT INTO patient VALUES('" + comboBox1.Text + "','" + textBox1.Text + "','" + comboBox2.Text +"','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; MessageBox.Show("OK", "Add Data ?", MessageBoxButtons.OK,MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Click OK", "Data Added Successfully",MessageBoxButtons.OK); conn.Close(); Search Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "SELECT*FROM patient WHERE pno='" + comboBox1.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("Completed !"); }
  • 19. reader = comm.ExecuteReader(); while (reader.Read()) { textBox1.Text = reader[1].ToString(); comboBox2.Text = reader[2].ToString(); textBox2.Text = reader[3].ToString(); textBox3.Text = reader[4].ToString(); textBox4.Text = reader[5].ToString(); } reader.Close(); Update Button String connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "UPDATE patient SET pno='" + comboBox1.Text + "',pn='" + textBox1.Text + "',db='" + comboBox2.Text + "',bg='" + textBox2.Text + "',da='" + textBox3.Text + "',dr='" + textBox4.Text + "'"; MessageBox.Show("Are u Sure", "Do You Want Update ?",MessageBoxButtons.OK, MessageBoxIcon.Error); OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Success", "Data Added Sucsessfully!",MessageBoxButtons.OK, MessageBoxIcon.Error); conn.Close(); Clear Button comboBox1.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; Delete Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "DELETE*FROM patient WHERE pno='" + comboBox1.Text + "'"; if (MessageBox.Show("Are You Sure Do You Want Delete This Record ?", "Sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionstring);
  • 20. OleDbCommand comm = new OleDbCommand(commandstring, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Deleted Successfully"); comboBox1.Text = ""; textBox1.Text = ""; comboBox2.Text = ""; textBox2.Clear(); textBox3.Clear(); textBox4.Text = ""; Exit Button this.Hide(); Help Window Select Button string connectionstring, commandstring; connectionstring =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Hosptal Management Systemesoft.mdb"; commandstring = "SELECT*FROM help WHERE se='" + comboBox1.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionstring); OleDbCommand comm = new OleDbCommand(commandstring, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show("......"); } reader = comm.ExecuteReader();
  • 21. while (reader.Read()) { textBox2.Text = reader[1].ToString(); } reader.Close(); Exit Button this.Hide(); Author Window Exit Button this.Hide(); Now I think you earned good knowledge about project . Now I hope to give you additional codes to solve some problems. ( These are additional codes ) privatevoid btnadd_Click(object sender, EventArgs e) { string connectionString, commandString; connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital SystemHMS.mdb"; commandString = "INSERT INTO Appoinment VALUES ('"+ cborefno.Text + "','" + txtpatname.Text + "','" + txtcontact.Text
  • 22. + "','" + txtaddress.Text + "','" + cbogender.Text + "','" + cboPayment.Text + "','" + txtamount.Text + "')"; OleDbConnection conn = newOleDbConnection(connectionString); OleDbCommand comm = newOleDbCommand(commandString, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Added Succesfully"); cborefno.Items.Add(cborefno.Text); Clear(); cborefno.Focus(); conn.Close(); } privatevoid cborefno_SelectedIndexChanged(object sender,EventArgs e ) { string connectionString, commandString; connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital SystemHMS.mdb"; commandString = "SELECT * FROM Appoinment WHERE RefNo='" + cborefno.Text + "'"; OleDbConnection conn = newOleDbConnection(connectionString); OleDbCommand comm = newOleDbCommand(commandString, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show(ex.Message); } reader = comm.ExecuteReader(); while (reader.Read()) { txtpatname.Text = reader[1].ToString(); txtcontact.Text = reader[2].ToString(); txtaddress.Text = reader[3].ToString(); cbogender.Text = reader[4].ToString(); cboPayment.Text = reader[5].ToString(); txtamount.Text = reader[6].ToString(); } reader.Close(); conn.Close(); } privatevoid Form1_Load(object sender, EventArgs e) {
  • 23. string connectionString, commandString; connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital SystemHMS.mdb"; commandString = "SELECT RefNo FROM Appoinment"; OleDbConnection conn = newOleDbConnection(connectionString); OleDbCommand comm = newOleDbCommand(commandString, conn); OleDbDataReader reader = null; try { conn.Open(); } catch (Exception ex) { MessageBox.Show(ex.Message); } reader = comm.ExecuteReader(); while (reader.Read()) { cborefno.Items.Add(reader[0]); } reader.Close(); conn.Close(); } privatevoid btnupdate_Click(object sender, EventArgs e) { string connectionString, commandString; connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital SystemHMS.mdb"; commandString = "UPDATE Appoinment SET PatName = '"+ txtpatname.Text + "', Contact = '" + txtcontact.Text + "', Address = '" + txtaddress.Text + "', Gender = '" + cbogender.Text + "',PayType = '" + cboPayment.Text +"',Amount='" + txtamount.Text + "' where RefNo = '" + cborefno.Text + "'"; if (MessageBox.Show("Are you sure, you want to Update this record?", "Sure?", MessageBoxButtons.YesNo) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionString); OleDbCommand comm = newOleDbCommand(commandString, conn);
  • 24. conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Updated Succesfully"); Clear(); cborefno.Focus(); conn.Close(); } privatevoid btndelete_Click(object sender, EventArgs e) { string connectionString, commandString; connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Hospital SystemHMS.mdb"; commandString = "DELETE Appoinment.RefNo FROM Appoinment where Appoinment.RefNo = '" + cborefno.Text + "'"; if (MessageBox.Show("Are you sure, you want to delete this record?", "Sure?", MessageBoxButtons.YesNo) == DialogResult.No) { return; } OleDbConnection conn = newOleDbConnection(connectionString); OleDbCommand comm = newOleDbCommand(commandString, conn); conn.Open(); comm.ExecuteNonQuery(); MessageBox.Show("Record Deleted Successfully"); conn.Close(); cborefno.Items.Remove(cborefno.Text); cborefno.Focus(); Clear(); } privatevoid Clear() { cborefno.Text = ""; txtpatname.Clear(); txtcontact.Clear(); txtaddress.Clear(); cbogender.Text = ""; cboPayment.Text = ""; txtamount.Clear(); cborefno.Focus(); } privatevoid btnclear_Click(object sender, EventArgs e)
  • 25. { Clear(); } privatevoid btnexit_Click(object sender, EventArgs e) { this.Hide(); } ******************************** About Me ! ******************************** Kasun Madhusanka Phone:+94770597830 Email:[email protected] To Make likes me on facebook click below link https://www.facebook.com/KKTMadhusanka To make connection with me ! https://www.linkedin.com/in/kktmadhusanka
  • 26. Posted by Kasun Madhusanka at 3:44 PM