0% found this document useful (0 votes)
2 views4 pages

M Rabi DAM Task 9

The document outlines a task for a Bachelor in Information Technology course at Superior University Lahore, focusing on database systems. It includes a C# function for updating student records in a database, with error handling for empty inputs and feedback messages for successful or invalid updates. Additionally, it features a reset function to clear input fields after execution.

Uploaded by

muhammadrabi59
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

M Rabi DAM Task 9

The document outlines a task for a Bachelor in Information Technology course at Superior University Lahore, focusing on database systems. It includes a C# function for updating student records in a database, with error handling for empty inputs and feedback messages for successful or invalid updates. Additionally, it features a reset function to clear input fields after execution.

Uploaded by

muhammadrabi59
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SUPERIOR UNIVERSITY LAHORE

Bachelor in Information Technology


Department: Computer Science & Information Technology
Subject: Database Systems
TASK: 09 (COMMAND EXECUTION QUERY RESULT)
Student name: M Rabi
Roll No: BITM-S20-002

Create function for text box:-

private void button2_Click(object sender, EventArgs e)

if ([Link] == "" && [Link] == "")

[Link]("Please enter the data");

else

SqlConnection connection = new SqlConnection("Server=ELITEBOOK\\


SQLEXPRESS; initial catalog=Labtask; Integrated Security=True;");

SqlCommand command = new SqlCommand("update tblstudent set


name=@name, Rollnumber=@Rollnumber where name=@name ");

[Link]("@name", [Link]);

[Link]("@Rollnumber", [Link]);

[Link] = connection;

[Link]();

[Link]();

[Link]();

[Link]("Thank You For updation!");

reset();

}
}

private void Form1_Load(object sender, EventArgs e)

void reset()

[Link]();

[Link]();

Screen shot:

Work : 2:-

EXECUTION EMPTY PROCESS CHECKING

CODE:
if ([Link] == "" && [Link] == "")

[Link]("Please enter the data");

else

SqlConnection connection = new SqlConnection("Server=ELITEBOOK\\


SQLEXPRESS; initial catalog=Labtask; Integrated Security=True;");

SqlCommand command = new SqlCommand("update tblstudent set


name=@name, Rollnumber=@Rollnumber where name=@name ");

[Link]("@name", [Link]);

[Link]("@Rollnumber", [Link]);

[Link] = connection;

[Link]();

if ([Link]() > 0)

[Link]("Thank You For updation!");

else

[Link]("INVALID DATA!");

[Link]();

reset();

SCREEN SHOT

You might also like