In Visual Studio .Net, creating a project is not difficult. It allows most of the things to drag and drop. It makes software development quite easy.
Today, we are discussing about how to create a Student Management System in Visual Studio .Net. For this purpose I have used Visual Studio 2008 and Oracle (any version).
First, we will have to create the database. We will use oracle for this purpose.
Below screenshot shows some tables that I have created in Oracle.
You can see, I have used some of the basic tables of this domain and also displayed the relationship among them. You can add or delete tables, fields in the tables, change the relationships as per your requirement.
To create these tables in Oracle we will have to write queries. You can also use some designer like Toad for this purpose. But I have used queries.
Here are the queries to generate these tables and their relationships:
First step is done.
Now we have to create dataset in Visual Studio. For this purpose, open Visual Studio, then Create C# or VB.Net project. Project must be Windows Form type.
Now add a dataset by right clicking on project and then 'Add New Item'. You can find Dataset in Data tab in the window that will be opened.
Right click on the dataset to Add Table, It will ask for your database connection. Create a new connection to your oracle database by providing it the required fields such as Host Name, password, etc. On clicking next button, All the tables of the database will appear. Select the required table, or select all the tables that we have created in the previous step. and click Finish.
Your dataset will be now ready. Compile the program to make sure there is no error. Now you can add database tables/fields to your form. Just open the form, open the Data Sources panel, drag one or more of the data table(s) appearing in it on to the form. You will see a Grid (table) will appear on the form. You can also drop fields instead of grid, by changing it to Details on Datasources panel before dropping.
Compile the program and enjoy :)
Hope you have understand the tutorial, you can feel free to ask any question.
Happy Coding :)
Today, we are discussing about how to create a Student Management System in Visual Studio .Net. For this purpose I have used Visual Studio 2008 and Oracle (any version).
First, we will have to create the database. We will use oracle for this purpose.
Below screenshot shows some tables that I have created in Oracle.
You can see, I have used some of the basic tables of this domain and also displayed the relationship among them. You can add or delete tables, fields in the tables, change the relationships as per your requirement.
To create these tables in Oracle we will have to write queries. You can also use some designer like Toad for this purpose. But I have used queries.
Here are the queries to generate these tables and their relationships:
CREATE TABLE COURSES
(
COURSE_ID NUMBER(10) PRIMARY KEY,
TITLE VARCHAR2(100) NOT
NULL,
CREDIT_HOURS NUMBER(5,2)
);
CREATE TABLE DEPARTMENT
(
DEPARTMENT_ID NUMBER(10) PRIMARY KEY,
NAME VARCHAR2(100 BYTE) NOT
NULL
);
CREATE TABLE EMPLOYEE
(
EMPLOYEE_ID NUMBER(10) PRIMARY KEY,
NAME VARCHAR2(100) NOT NULL,
QUALIFICATION VARCHAR2(50),
SALARY NUMBER(10,2),
DESIGNATION VARCHAR2(100),
DEPARTMENT_ID NUMBER(10),
CONSTRAINT FK_EMPLOYEE_R01
FOREIGN KEY (DEPARTMENT_ID)
REFERENCES DEPARTMENT (DEPARTMENT_ID)
);
CREATE TABLE FACULTY
(
FACULTY_ID NUMBER(10) PRIMARY KEY,
EMPLOYEE_ID NUMBER(10) NOT
NULL,
IS_VISITING_FACULTY NUMBER(1) DEFAULT 0 NOT
NULL,
CONSTRAINT FK_FACULTY_R01
FOREIGN KEY (EMPLOYEE_ID)
REFERENCES EMPLOYEE (EMPLOYEE_ID)
);
CREATE TABLE FACULTY_COURSES
(
FACULTY_ID NUMBER(10),
COURSE_ID NUMBER(10),
CONSTRAINT FK_FACULTY_COURSES_R01
FOREIGN KEY (FACULTY_ID)
REFERENCES FACULTY (FACULTY_ID),
CONSTRAINT FK_FACULTY_COURSES_R02
FOREIGN KEY (COURSE_ID)
REFERENCES COURSES (COURSE_ID)
);
CREATE TABLE EXAMS
(
EXAM_ID NUMBER(10) PRIMARY KEY,
SEASON VARCHAR2(10 BYTE) NOT NULL,
YEAR NUMBER(4) NOT NULL,
EXAM_TYPE VARCHAR2(10 BYTE) NOT NULL,
PASSING_MARKS NUMBER(10,2)
);
CREATE TABLE EXAM_RESULTS
(
RESULT_ID NUMBER(10) PRIMARY KEY,
EXAM_ID NUMBER(10) NOT NULL,
FACULTY_ID NUMBER(10) NOT NULL,
COURSE_ID NUMBER(10) NOT NULL,
STUDENT_ID NUMBER(10) NOT NULL,
MARKS_OBTAINED NUMBER(10) NOT NULL,
GPA NUMBER(4,2),
STATUS VARCHAR2(4 BYTE),
CONSTRAINT FK_EXAM_RESULTS_R01
FOREIGN KEY (EXAM_ID)
REFERENCES EXAMS (EXAM_ID),
CONSTRAINT FK_EXAM_RESULTS_R02
FOREIGN KEY (FACULTY_ID)
REFERENCES FACULTY (FACULTY_ID),
CONSTRAINT FK_EXAM_RESULTS_R03
FOREIGN KEY (COURSE_ID)
REFERENCES COURSES (COURSE_ID),
CONSTRAINT FK_EXAM_RESULTS_R04
FOREIGN KEY (STUDENT_ID)
REFERENCES STUDENT (STUDENT_ID)
);
CREATE TABLE STAFF
(
STAFF_ID NUMBER(10) PRIMARY KEY,
EMPLOYEE_ID NUMBER(10) NOT NULL,
JOB_DESCRIPTION VARCHAR2(255 BYTE),
CONSTRAINT FK_STAFF_R01
FOREIGN KEY (EMPLOYEE_ID)
REFERENCES EMPLOYEE (EMPLOYEE_ID)
);
CREATE TABLE STUDENT
(
STUDENT_ID NUMBER(10) PRIMARY KEY,
NAME VARCHAR2(100 BYTE) NOT NULL,
ADDRESS VARCHAR2(255 BYTE) NOT NULL,
SEMESTER NUMBER(2) NOT NULL
);
CREATE TABLE STUDENT_COURSES
(
STUDENT_ID NUMBER(10) NOT NULL,
COURSE_ID NUMBER(10) NOT NULL,
CONSTRAINT FK_STUDENT_COURSES_R01
FOREIGN KEY (STUDENT_ID)
REFERENCES STUDENT (STUDENT_ID),
CONSTRAINT FK_STUDENT_COURSES_R02
FOREIGN KEY (COURSE_ID)
REFERENCES COURSES (COURSE_ID)
);
Now we have to create dataset in Visual Studio. For this purpose, open Visual Studio, then Create C# or VB.Net project. Project must be Windows Form type.
Now add a dataset by right clicking on project and then 'Add New Item'. You can find Dataset in Data tab in the window that will be opened.
Right click on the dataset to Add Table, It will ask for your database connection. Create a new connection to your oracle database by providing it the required fields such as Host Name, password, etc. On clicking next button, All the tables of the database will appear. Select the required table, or select all the tables that we have created in the previous step. and click Finish.
Your dataset will be now ready. Compile the program to make sure there is no error. Now you can add database tables/fields to your form. Just open the form, open the Data Sources panel, drag one or more of the data table(s) appearing in it on to the form. You will see a Grid (table) will appear on the form. You can also drop fields instead of grid, by changing it to Details on Datasources panel before dropping.
Compile the program and enjoy :)
Hope you have understand the tutorial, you can feel free to ask any question.
Happy Coding :)
No comments:
Post a Comment