OOP C# and MA
Submitted by meftah on Tuesday, March 17, 2015 - 23:29.
Language
This is an example project using OOP C#. Hope this system can help you in your future project. Below are codes used in this system.
Hope you learn from this.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
- using System.Data.OleDb;
- using System.Collections;
- namespace employeesapp
- {
- class employee
- {
- public string EmpID;
- public string Name;
- public string Jobtitle;
- public string Company;
- public DataSet get()
- {
- OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Employees.mdb");
- conn.Open();
- da.Fill(ds);
- return ds;
- }
- public void AddNew()
- {
- OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Employees.mdb");
- conn.Open();
- OleDbCommand cmd = new OleDbCommand("Insert Into employee([Name],[Jobtitle],[Company])Values ('" + Name + "','" + Jobtitle + "','" + Company + "')", conn);
- cmd.ExecuteNonQuery();
- }
- public void Update()
- {
- OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Employees.mdb");
- conn.Open();
- //OleDbCommand cmd = new OleDbCommand("Update employee([Name],[Jobtitle],[Company])Values ('" + Name + "','" + Jobtitle + "','" + Company + "')",conn);
- OleDbCommand cmd = new OleDbCommand(" Update employee set ([Name],[Jobtitle],[Company])Values ('" + Name + "','" + Jobtitle + "','" + Company + "' where EmpID='" + EmpID + "')", conn);
- cmd.ExecuteNonQuery();
- }
- public void Delete()
- {
- OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Employees.mdb");
- conn.Open();
- cmd.ExecuteNonQuery();
- }
- }
- }
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Comments
Add new comment
- Add new comment
- 239 views