Dbms Lab 1 To 9 My Muneer
Dbms Lab 1 To 9 My Muneer
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
SQL Server Management Studio (SSMS) is a windows software or a client tool used to
connect and work with our SQL Server from a graphical interface instead of using the
command line. it allows DBAs and database developers to configure, manage,
and administer all components within SQL Server. Its main functionality is to create
databases and tables, execute SQL queries for inserting, updating, and deleting data, creating
and managing stored procedures, triggers, views, and cursors. It also enables us to set
privileges (securities) on databases and their objects.
1. Go to the Microsoft SQL server setup folder and then double click on the setup of
SQLserver.
3. NEXT, when you click on the basic, so Microsoft SQL server license terms’ screen
appear leave it as it is and click on the ACCEPT.
5. Once you click on install so downloading and installing progress screen will apper,
first the downloading of SQL server will start after the completion of downloading the
system will start installation.
7. Now to check that SQL server installed correctly so click on connect now if it
generate that notification its mean SQL server installed correctly.
9. Once you start the installation of the SSMS then wait until packages progress and overall progress not
complete.
11. Now connect the management studion to the server by browsing the servername and
then laver the other things as default and then click on connect.
Figure 12 SS
Observations:
In conclusion, this lab has equipped us with the knowledge and practical skills required to
install Microsoft SQL Server and SQL Server Management Studio. Understanding the system
requirements, installation steps, and security considerations is essential for anyone who
intends to work with SQL Server databases.
Rubrics:
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
DDL:
Create an object
DDL 1. Create
2. Alter
3. Drop
4. Truncate
b) Entity Integrity
c) Referential Integrity
This constraint sets a range and any violations that takes place will
prevent the user from performing the manipulation that caused the
breach. It includes:
Not Null constraint:
While creating tables, by default the rows can have null value. the
enforcement of not null constraint in a table ensure that the table
contains values.
Example: Create table cust(custid number(6) not null, name
char(10)); Alter table cust modify (name not null);
This command will ensure that the user enters a value for the
Domain Integrity custid, name columns on the cust table, failing which it returns an
error message.
Check Constraint
Check constraint can be defined to allow only a particular range of
values. when the manipulation violates this constraint, the record
will be rejected.
Example:
Create table student (regno number (6), mark number (3)
11 | P a g e SUBMITTED TO: Mr. Rehmat
LAB MANUAL : [ DATABASE management SYSTEM ]
constraint b check
(mark >=0 and mark <=100));
Alter table student add constraint b2 check (length(regno<=4));
DML:
What Does Data Manipulation Language (DML) Mean?
A data manipulation language (DML) is a family of computer languages including commands
permitting users to manipulate data in a database. This manipulation involves inserting data
into database tables, retrieving existing data, deleting data from existing tables and modifying
existing data. DML is mostly incorporated in SQL databases.
DML resembles simple English language and enhances efficient user interaction with the
system. The functional capability of DML is organized in manipulation commands like
SELECT, UPDATE, INSERT INTO and DELETE FROM, as described below:
SELECT: This command is used to retrieve rows from a table. The syntax is
SELECT [column name(s)] from [table name] where [conditions]. SELECT is the
most widely used DML command in SQL.
UPDATE: This command modifies data of one or more records. An update command
syntax is UPDATE [table name] SET [column name = value] where [condition].
INSERT: This command adds one or more records to a database table. The insert
command syntax is INSERT INTO [table name] [column(s)] VALUES [value(s)].
DELETE: This command removes one or more records from a table according to
specified conditions. Delete command syntax is DELETE FROM [table name] where
[condition].
Product no Description Unit measure Qty_on_hand Cost Price Sell Price Profit %
P00001 1.44floppies 100 20 500 525 5
P03453 Monitors 10 3 11200 12000 6
P06734 Mouse 20 5 500 1050 5
P07865 1.22 floppies 100 20 500 525 5
P07868 Keyboards 10 3 3050 3150 2
P07885 CD Drive 10 3 5100 5250 2.5
Implement the following tables in new Query and attached screenshot of your code and
output
Clint Master:
Conclusion:
In conclusion, understanding the distinction between DDL and DML is fundamental for
anyone working with relational databases and SQL. DDL is the language for defining and
managing the database structure, while DML is used for interacting with the data itself. Both
are essential tools in the world of database management, and a solid grasp of these concepts
is crucial for designing, maintaining, and working with databases effectively. This lab has
provided a strong foundation for further exploration and practical application of DDL and
DML in the context of database management.
Rubrics:
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
In Microsoft SQL Server, a database table is a structured object that stores data in a tabular
format. Tables are the fundamental building blocks of a relational database system, and they
play a crucial role in organizing and storing data efficiently. In this lab, you will learn how to
create tables in MS SQL Server, define their structure, and set constraints to ensure data
integrity.
Table Structure:
Before you create a table, it's essential to understand the structure of a table and its
components:
1. Table Name: Each table in SQL Server must have a unique name within the
database. The table name should be descriptive and indicative of the data it will store.
2. Columns (Fields): Tables consist of one or more columns, also known as fields. Each
column defines the type of data it can hold (e.g., text, numbers, dates) and can have
various constraints such as NOT NULL, unique, or primary key constraints.
3. Data Types: SQL Server provides a wide range of data types to define the kind of
data that can be stored in each column, such as INT, VARCHAR, DATETIME, etc.
4. Constraints: Constraints are rules that you can apply to columns to maintain data
integrity. Common constraints include PRIMARY KEY, FOREIGN KEY, UNIQUE,
and CHECK constraints.
Creating Tables:
To create a table in MS SQL Server, you will typically use the CREATE TABLE statement.
Here is the basic syntax:
Syntax
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype );
CREATE TABLE is the keyword telling the database system what you want to do. In this
case, you want to create a new table. The unique name or identifier for the table follows the
CREATE TABLE statement.
Then in brackets comes the list defining each column in the table and what sort of data type it
is. The syntax becomes clearer with the following example.
A copy of an existing table can be created using a combination of the CREATE TABLE
statement and the SELECT statement. You can check the complete details at Create Table
Using another Table.
1st we will create table using create command then insert in the bractkets the data
type of all the columns in the table.
Then put the value into the tables using insert and set command.
Lab Task 1
Lab Task 2
Create two tables one for Employee (EmpID, EmpName, EmpSalary, EmpEmail,
EmpDateOfBirth, EmpDepartment) and Second for department (DepID, DepName, DepHod,
DepEmail) insert data into each table and take screenshots. Set the data types and also apply
constraints:
Employee Table:
Conclusion:
In conclusion, the ability to create tables in Microsoft SQL Server is a fundamental skill for
anyone working with relational databases. This lab has equipped you with the knowledge and
practical experience needed to define table structures, choose data types, and establish
constraints. Understanding the SQL syntax for table creation and the importance of data
integrity mechanisms is essential for successful database design and management. This lab
serves as a solid foundation for further exploration of database development and
administration in SQL Server.
Rubrics:
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
A Primary key is a unique column we set in a table to easily identify and locate data in
queries. A table can have only one primary key. The primary key column has a unique value
and doesn’t store repeating values. A Primary key can never take NULL values.
For example, in the case of a student when identification needs to be done in the class, the
roll number of the student plays the role of Primary key.
Similarly, when we talk about employees in a company, the employee ID is functioning as
the Primary key for identification.
Let us now understand the Syntax of creating the table with the Primary key specified.
Syntax:
Query:
CREATE TABLE DataFlair(
name varchar(50),
location varchar(50),
experience int,
PRIMARY KEY(emp_id));
Output:
Lab Task
Create a Primary Key and Foreign Key for two tables i.e. Student’s Table and Subject’s
Table also add the procedure (query) and output screenshots with the lab task.
Conclusion:
In conclusion, understanding how to create primary and foreign keys is essential for anyone
working with Microsoft SQL Server and relational databases. These keys are fundamental
tools for maintaining data integrity, establishing relationships between tables, and ensuring
the accuracy and consistency of data. This lab provides a solid foundation for further
exploration of database design, management, and optimization within SQL Server. By
implementing primary and foreign keys effectively, you are better equipped to build robust
and reliable database systems.
Rubrics:
Report not Plagiarized Requirements Observations Appropriate Correctly
submitted content are listed and are recorded computation drawn
presented or experimental along with s or conclusion
Laboratory incomplete procedure is detailed numerical with
Reports submission or presented procedure analysis is exact results
late performed and complete
report in all
respects
Category Ungraded Very Poor Poor Fair Good Excellent
Marks 0 1 2 3 4 5
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
Queries
Select statement:
The SELECT statement is used to select data from a database. The data returned is stored in a
result table, called the result-set.
Syntax
SELECT column1, column2, ...
FROM table_name;
Here, column1, column2, ... are the field names of the table you want to select data from. If
you want to select all the fields available in the table, use the following syntax:
Example:
select name from student;
Select distinct
The SELECT DISTINCT statement is used to return only distinct (different) values.
Inside a table, a column often contains many duplicate values; and sometimes you only want
to list the different (distinct) values.
Syntax
SELECT DISTINCT column1, column2, ...
FROM table_name;
Example
select DISTINCT city from student;
Where
The WHERE clause is used to filter records. It is used to extract only those records that fulfill a
specified condition.
Syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Example
select name from student
where
city = 'quetta';
Figure 29 Where
34 | P a g e SUBMITTED TO: Mr. Rehmat
LAB MANUAL : [ DATABASE management SYSTEM ]
The WHERE clause can be combined with AND, OR, and NOT operators.
The AND and OR operators are used to filter records based on more than one condition:
The AND operator displays a record if all the conditions separated by AND are
TRUE.
The OR operator displays a record if any of the conditions separated by OR is TRUE.
AND syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition1 AND condition2 AND condition3 ...;
Example
select name from student
where
city = 'quetta' AND grade = 'A';
OR syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition1 OR condition2 OR condition3 ...;
Example;
select name from student
where
city = 'quetta' OR grade = 'A' OR city = 'karachi';
Figure 31 OR syntax
35 | P a g e SUBMITTED TO: Mr. Rehmat
LAB MANUAL : [ DATABASE management SYSTEM ]
NOT syntax
SELECT column1, column2, ...
FROM table_name
WHERE NOT condition;
Example
select * from student
where
NOT city = 'quetta';
Order by
The ORDER BY keyword is used to sort the result-set in ascending or descending order.
The ORDER BY keyword sorts the records in ascending order by default. To sort the records
in descending order, use the DESC keyword.
Syntax
SELECT column1, column2, ...
FROM table_name
ORDER BY column1, column2, ... ASC|DESC;
Example
select * from student
ORDER BY name;
Figure 33 Order by
36 | P a g e SUBMITTED TO: Mr. Rehmat
LAB MANUAL : [ DATABASE management SYSTEM ]
Insert into
The INSERT INTO statement is used to insert new records in a table.
Syntax
Create the above table in SSMS in the give answer to each task.
LAB TASK 1
Q: Make a table for employees with the columns: Employees Id, Name, Age,
Department, City, DateOfBirth, and Salary filled with some values. Use the SQL
queries listed above, and attached the screenshots of your code and outputs.
Table:
Result:
LAB TASK 2
Let's start by grabbing all of the data in one table. We have a table
called family_members that is shown below. In order to grab all of that data, please run
the following command: SELECT * FROM family_members;
Table:
Figure 39 Table
Result:
Figure 40 Result
LAB TASK 4
SELECT * FROM family_members WHERE species = 'human';
Note that the quotes have to be around the word human, as it is an explicit value, unlike
a keyword such as WHERE.
Table:
Figure 41 Species
Result:
Figure 42 Result
LAB TASK 5
SQL accepts various inequality symbols, including:
= "equal to"
> "greater than"
< "less than"
>= "greater than or equal to"
<= "less than or equal to"
Result:
Figure 43 Result:
LAB TASK 6
Can you return all rows in family_members where num_books_read is a value greater
or equal to 150?
Figure 44 Table
Result:
Figure 45 Result
LAB TASK 7
Can you find all of Pickles' friends that are dogs or under the height of 45cm?
Table:
Figure 46 Command
Result:
Figure 47 Result
LAB TASK 8
Can you run a query that sorts the friends_of_pickles by height_cm in descending order?
Table:
Figure 49 Result:
Conclusion:
In this lab I have learned how to retrieve and filter data using the `SELECT` statement,
including the use of `SELECT DISTINCT` to obtain unique values. The `WHERE` clause
helps us filter data based on specific conditions, and logical operators like `AND`, `OR`, and
`NOT` allow us to create complex conditions. Sorting of results was demonstrated using the
`ORDER BY` clause.
Rubrics
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
Queries
Null values:
If a field in a table is optional, it is possible to insert a new record or update a record without
adding a value to this field. Then, the field will be saved with a NULL value.
Syntax
We will have to use the IS NULL and IS NOT NULL operators
Is NULL syntax
SELECT column_names
FROM table_name
WHERE column_name IS NULL;
SELECT column_names
FROM table_name
Example:
select name, city, grade
from student
where grade IS NOT NULL;
Update:
Update syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example
UPDATE student
SET name = 'khan kakar', City= 'peshawar'
WHERE StudentID = 50348;
Delete statement:
Delete syntax
The SELECT TOP clause is used to specify the number of records to return.
The SELECT TOP clause is useful on large tables with thousands of records. Returning a large
number of records can impact performance.
The MIN() function returns the smallest value of the selected column.
The MAX() function returns the largest value of the selected column.
MIN() syntax
SELECT MIN(column_name)
FROM table_name
WHERE condition;
Example:
SELECT MIN(age) AS Smallestage
FROM student;
MAX() syntax
SELECT MAX(column_name)
FROM table_name
WHERE condition;
Example;
SELECT MAX(age) AS largestage
FROM student;
Count() function
The COUNT() function returns the number of rows that matches a specified criterion.
Count syntax
SELECT COUNT(column_name)
FROM table_name
WHERE condition;
Example:
SELECT COUNT(StudentID)
FROM student;
AVG() function
The AVG() function returns the average value of a numeric column.
AVG() syntax
SELECT AVG(column_name)
FROM table_name
WHERE condition;
Example:
SELECT AVG(age)
FROM student;
SUM() function
The SUM() function returns the total sum of a numeric column.
SUM syntax
SELECT SUM(column_name)
FROM table_name
WHERE condition;
Example:
SELECT SUM(age)
FROM student;
LIKE operator
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
There are two wildcards often used in conjunction with the LIKE operator:
Like Syntax
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
Example:
SELECT * FROM student
WHERE name LIKE 'k%';
Wildcard characters:
Wildcard characters are used with the LIKE operator. The LIKE operator is used in
a WHERE clause to search for a specified pattern in a column.
Example:
SELECT * FROM student
Lab Task:
1. Null Values:
Task: Create a table named "Students" with columns for
"StudentID" (INT), "FirstName" (VARCHAR), and "LastName"
(VARCHAR). Insert a few records where some students have a
NULL value for their last name.
Query: Write a SQL query to select all students with NULL last
names.
Rubrics
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
Join:
SQL Join statement is used to combine data or rows from two or more tables based on a
common field between them.
Inner Join:
An inner join is the one in which only those tuples are included that satisfy some conditions.
In this article, we will be using SQL Server to demonstrate the working of SQL Inner Join.
Figure 74
Figure 75
How the INNER JOIN works:
1. Two or more tables are specified in the SQL query.
2. A condition is defined in the ON clause, which specifies the column(s) that should
match between the tables.
3. The tables are joined based on the matching column(s), and only the rows with
matching values are returned in the result set.
4. If there are multiple matching rows, the join returns a combination of those rows.
5. INNER JOIN can be used with additional conditions in the WHERE clause to further
filter the result set.
Left Join:
This join returns all rows from the table to the left of the join and matches rows from the
table to the right of the join. The result-set will contain null for rows for which there is no
matching row on the right side. LEFT OUTER JOIN is another name for LEFT JOIN.
Figure 76
Syntax of Left Join:
Figure 77
How the LEFT JOIN works:
1. The query begins by selecting the desired columns from the “table1” and “table2”.
2. It then specifies the LEFT JOIN clause to indicate that it'll be performing a LEFT
JOIN operation.
3. The ON keyword is used to specify the condition for joining the tables. It defines the
matching column(s) between the “table1” and “table2”.
4. The query executes the join operation by matching the values of the specified
column(s) in both tables.
5. If there is a match, the result set will contain the combined row with values from both
tables.
6. If there is no match, the result set will still include all rows from the table1, with
NULL values for the columns from the “table2”.
RIGHT JOIN:
In SQL, a right join returns all the records from the right table as well as the matching records
from the left table based on the join condition. It is also referred to as a right outer join.
According to one theory, the right join in SQL is most commonly used when we want to
prioritize the records from the right table while also including any matching records from the
left table. This means that even if there is no matching record in the left table, the result of a
right join will always include all of the records from the right table. The result will contain
NULL values for non-matching records from the left table.
Figure 78
Syntax of RIGHT JOIN:
Figure 79
How the RIGHT JOIN works:
1. Start by identifying the two tables you want to join. Let's call them Table 1 and Table
2.
2. Specify the join condition using the ON keyword. It determines how the records
should be matched between the two tables. For example, if you want to join based on
a common column called "id", the join condition could be "Table1.id = Table2.id".
3. Begin the SQL query with the SELECT statement, listing the columns you want to
include in the final result. You can include columns from both tables.
4. Next, include the FROM clause to indicate the tables you want to join. For example,
"FROM Table1" followed by "RIGHT JOIN Table2".
5. Use the ON keyword to specify the join condition created in step 2. For example, "ON
TableA.id = TableB.id".
6. Optionally, you can add additional conditions using the WHERE clause to further
filter the result set.
7. Complete the query with any additional clauses you need, such as GROUP BY,
ORDER BY, or LIMIT.
8. Execute the SQL query, and the database will perform the right join operation.
9. The result set will contain all the records from Table 2 (right table) and the matched
records from Table 1 (left table) based on the join condition.
10. If no match is found for a record in Table B, the columns from Table A will have
NULL values in the result set.
FULL JOIN:
The result-set is created by combining the results of both LEFT JOIN and RIGHT JOIN. The
result set will include all rows from both tables. The result-set will contain NULL values for
rows where there is no match. FULL JOIN can potentially return very large result-sets!
Figure 80
Figure 81
How FULL JOIN works:
1. When a Full Join is performed, the output will include all of the rows from both tables.
2. If the related columns match, the corresponding columns from both tables will be
displayed in a single row.
3. If there is no match, NULL values will be displayed in the table columns where no
corresponding record exists.
SELF JOIN:
A self-join is a join procedure in which a table is attached to itself. To put it another way, it is
a method of combining rows from the same table. This is very handy for comparing or
analyzing data inside the same table.
Syntax of SELF JOIN:
Figure 82
How SELF JOIN works:
1. SELECT columns: With the help of this we specify the columns you want to retrieve
from the self-joined table.
2. FROM table AS alias1: With the help of this we specify the name of the table you want to
join with itself.
3. JOIN table AS alias2: In this we use the JOIN keyword to show that we are performing a
SELF JOIN on the same table.
Tasks:
Output:
Scenario: Think of an office where you want to create a report of all departments and the
employees (students) in each department. Some departments might have no employees,
and some students may not be assigned to any department.
Task: Write an SQL query using a RIGHT JOIN to list department names and student
names for all departments, including those without students.
Query:
Task: Write an SQL query using a FULL JOIN to list student names and department
names for all students and departments.
Scenario 3: Student Advisors
Query:
Table: Students
Scenario: In a school, each student might have another student as their advisor. You want
to create a list of students and their respective advisors.
Task: Write an SQL query using a SELF JOIN to list each student's name and
their advisor's name.
Query:
Conclusion:
In this lab I have learned the SQL joins, SQL join are a fundamental tool for working with
relational databases, allowing us to bring together related data from multiple tables to answer
complex questions and extract valuable insights. Understanding the various types of joins and
when to use them is crucial for anyone working with SQL and database management. This
lab has provided a solid foundation for using joins effectively in real-world database queries
and applications.
Rubrics:
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
File A file is basically a system object stored in the memory at a particular given directory
with a proper name and extension. In C#, we call a file as stream if we use it for writing or
reading data.
C# FileStream:
File stream offers a path for performing file operations. It is mainly used for reading and
writing data into the files.
C# StreamWriter:
The StreamWriter class in C# is used for writing characters to a stream. It uses the
TextWriter class as a base class and provides the overload methods for writing data into a
file.
C# StreamReader:
The StreamReader is used for reading string or large sentences from a file. The StreamReader
also uses the TextReader class as its base class and then offers methods like Reading and
ReadLine to read data from the stream.
Code
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
while (true)
{
Student S = new Student();
Console.WriteLine("Enter The value");
Console.WriteLine("Enter 1 for Add a new student \nEnter 2 to get all students\
nEnter 3 to search a specific student");
int n;
n = int.Parse(Console.ReadLine());
Console.WriteLine("You Entered " + n);
if (n == 1)
{
Console.WriteLine("Enter no of student u want to add");
int no_of_student = int.Parse(Console.ReadLine());
for (int i = 0; i < no_of_student; i++)
{
Console.WriteLine("Add new Student");
Console.WriteLine("Enter student name");
S.Name = Console.ReadLine();
Console.WriteLine("Enter CMS ID");
S.CMS_ID = int.Parse(Console.ReadLine());
Console.WriteLine("Enter student GPA");
S.gpa = float.Parse(Console.ReadLine());
Console.WriteLine("Enter department name");
S.Department = (Console.ReadLine());
using (StreamWriter sw = new StreamWriter("D:\\Studentdata.txt", true))
{
sw.WriteLine(S.Name + " " + S.CMS_ID + " " + S.gpa + " " +
S.Department + " ");
}
Console.Clear();
}
}
else if (n == 2)
{
Console.WriteLine("Get all students");
using (StreamReader sr = new StreamReader("D:\\Studentdata.txt"))
{
string line = sr.ReadLine();
while (line != null)
{
Console.WriteLine(line);
line = sr.ReadLine();
}
}
}
else if (n == 3)
{
Console.WriteLine("Search a student");
LAB TASK
Q: Use StreamWriter to create a new text file and write your name, cms, dept, and
faculty to the file & use StreamReader to read the data. Attach the screenshot of your
code and your output.
Figure 99 C# output 2
Rubrics:
Marks 0 1 2 3 4 5
Lab outcomes:
SOFTWARE REQUIRED:
Theory:
Windows Form: Windows Forms is a Graphical User Interface(GUI) class library which is
bundled in .Net Framework. Its main purpose is to provide an easier interface to develop the
applications for desktop, tablet, PCs. It is also termed as the WinForms. The applications
which are developed by using Windows Forms or WinForms are known as the Windows
Forms Applications that runs on the desktop computer. WinForms can be used only to
develop the Windows Forms Applications not web applications. WinForms applications can
contain the different type of controls like labels, list boxes, tooltip etc.
C# FileStream:
File stream offers a path for performing file operations. It is mainly used for reading and
writing data into the files.
C# StreamWriter:
The StreamWriter class in C# is used for writing characters to a stream. It uses the
TextWriter class as a base class and provides the overload methods for writing data into a
file.
C# StreamReader:
The StreamReader is used for reading string or large sentences from a file. The StreamReader
also uses the TextReader class as its base class and then offers methods like Reading and
ReadLine to read data from the stream.
Program
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
semister = Semister,
Department = Dept,
name = Name,
Gpa = float.Parse(gpa.Trim())
};
students.Add(std);
line = sr.ReadLine();
}
dataGridView1.DataSource = students;
}
}
}
}
Output:
LAB TASK
Q: Create a Windows form for Coffee shop and utilize StreamWriter & StreamReader
in your code. Attached the screenshot of your code and output.
Rubrics:
Marks 0 1 2 3 4 5