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.
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

What's hot

Basics of E-Mail
Basics of E-MailBasics of E-Mail
Basics of E-Mail
ruledbyrobotics2080
 
Information security and other issues
Information security and other issuesInformation security and other issues
Information security and other issues
Haseeb Ahmed Awan
 
Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...
SHUBHAM PATIDAR FISHERIES ADDAA
 
Umc_18_CMOS
Umc_18_CMOSUmc_18_CMOS
Umc_18_CMOS
Darshil Shah
 
Excel training
Excel trainingExcel training
Excel training
Alexandru Gologan
 
Internet ,merits demerits, features
Internet ,merits demerits, featuresInternet ,merits demerits, features
Internet ,merits demerits, features
Kiran Kurian Philip
 
Digital camera
Digital cameraDigital camera
Digital cameraNoOr Tariq
 
Excel Top 10 formula For The Beginners
Excel Top 10 formula For The BeginnersExcel Top 10 formula For The Beginners
Excel Top 10 formula For The Beginners
Stat Analytica
 
Tài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng Việt
Tài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng ViệtTài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng Việt
Tài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng Việt
Duy Thanh
 
MS Excel
MS ExcelMS Excel
MS Excel
sharaineignacio
 
Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...
Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...
Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...
AbeerTariq7
 

What's hot (11)

Basics of E-Mail
Basics of E-MailBasics of E-Mail
Basics of E-Mail
 
Information security and other issues
Information security and other issuesInformation security and other issues
Information security and other issues
 
Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...Features of machine language, assembly language, high level language & their ...
Features of machine language, assembly language, high level language & their ...
 
Umc_18_CMOS
Umc_18_CMOSUmc_18_CMOS
Umc_18_CMOS
 
Excel training
Excel trainingExcel training
Excel training
 
Internet ,merits demerits, features
Internet ,merits demerits, featuresInternet ,merits demerits, features
Internet ,merits demerits, features
 
Digital camera
Digital cameraDigital camera
Digital camera
 
Excel Top 10 formula For The Beginners
Excel Top 10 formula For The BeginnersExcel Top 10 formula For The Beginners
Excel Top 10 formula For The Beginners
 
Tài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng Việt
Tài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng ViệtTài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng Việt
Tài Liệu Hướng Dẫn Sử Dụng Phần Mềm Vtiger CRM Tiếng Việt
 
MS Excel
MS ExcelMS Excel
MS Excel
 
Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...
Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...
Internet & Email & collaborative Computing & Social Networking by Abeer Ali 👍...
 

Similar to Ditec esoft C# project

CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
Achmad Sidik
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
Sandeep Joshi
 
Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
Yusman Kurniadi
 
Soa lab
Soa lab   Soa lab
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
AustinaGRPaigey
 
New text document
New text documentNew text document
New text document
Tam Ngo
 
The Ring programming language version 1.5.3 book - Part 12 of 184
The Ring programming language version 1.5.3 book - Part 12 of 184The Ring programming language version 1.5.3 book - Part 12 of 184
The Ring programming language version 1.5.3 book - Part 12 of 184
Mahmoud Samir Fayed
 
Tutorial 6.docx
Tutorial 6.docxTutorial 6.docx
Tutorial 6.docx
KrishnaAntala
 
in order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdfin order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdf
kalerottnerheissst52
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
fathimalinks
 
The Ring programming language version 1.9 book - Part 18 of 210
The Ring programming language version 1.9 book - Part 18 of 210The Ring programming language version 1.9 book - Part 18 of 210
The Ring programming language version 1.9 book - Part 18 of 210
Mahmoud Samir Fayed
 

Similar to Ditec esoft C# project (20)

Quanlycanbo
QuanlycanboQuanlycanbo
Quanlycanbo
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
Inventory management
Inventory managementInventory management
Inventory management
 
syed
syedsyed
syed
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Soa lab
Soa lab   Soa lab
Soa lab
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
 
New text document
New text documentNew text document
New text document
 
Hems
HemsHems
Hems
 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
 
The Ring programming language version 1.5.3 book - Part 12 of 184
The Ring programming language version 1.5.3 book - Part 12 of 184The Ring programming language version 1.5.3 book - Part 12 of 184
The Ring programming language version 1.5.3 book - Part 12 of 184
 
Tutorial 6.docx
Tutorial 6.docxTutorial 6.docx
Tutorial 6.docx
 
Q
QQ
Q
 
Borrar
BorrarBorrar
Borrar
 
in order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdfin order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdf
 
Insertarbotones en c
Insertarbotones en cInsertarbotones en c
Insertarbotones en c
 
C#
C#C#
C#
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
 
The Ring programming language version 1.9 book - Part 18 of 210
The Ring programming language version 1.9 book - Part 18 of 210The Ring programming language version 1.9 book - Part 18 of 210
The Ring programming language version 1.9 book - Part 18 of 210
 

Recently uploaded

MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 

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.
  • 2.
  • 3.
  • 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: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
  • 26. Posted by Kasun Madhusanka at 3:44 PM