Complete CRUD Operation in Asp.Net C# With SQL Server Step by Step

ProgrammingGeek
2 Dec 202024:51

Summary

TLDRThis tutorial guide walks viewers through creating a complete CRUD (Create, Read, Update, Delete) operation in ASP.NET using C# with SQL Server. Starting with setting up a new project, designing the webpage, and creating databases and tables, it progresses to connecting SQL Server with Visual Studio and coding for CRUD functionalities. The video demonstrates inserting records into a database, updating them, and retrieving data to display in a grid view, ensuring a hands-on understanding of database interactions in web development.

Takeaways

  • πŸ˜€ The tutorial is focused on creating a CRUD (Create, Read, Update, Delete) operation in ASP.NET with C# and SQL Server.
  • πŸ› οΈ The process starts with creating a new project in Visual Studio and designing the webpage for the CRUD operations.
  • πŸ“ The tutorial covers creating a database and table in SQL Server, including setting up the columns and data types for the 'student info' table.
  • πŸ”— It explains how to connect SQL Server to Visual Studio, which is essential for database operations within an ASP.NET application.
  • πŸ“‘ The script details the steps to design the user interface with HTML elements like div, table, label, text box, combo box, and button.
  • πŸ–±οΈ The video demonstrates adding event handlers for the 'Insert' button to perform data insertion into the SQL Server database.
  • πŸ” The 'Load Records' method is introduced to fetch and display records from the database in a GridView control.
  • πŸ›‘ The tutorial includes implementing 'Update' and 'Delete' operations with corresponding button click events and SQL command executions.
  • πŸ”„ The script also covers how to retrieve and populate data into text boxes and combo boxes based on selected student IDs.
  • πŸ—‘οΈ A confirmation message is added before performing delete operations to prevent accidental data loss.
  • πŸŽ‰ The tutorial concludes with successfully demonstrating the CRUD operations and encourages viewers to subscribe for more content.

Q & A

  • What is the main topic of the tutorial video?

    -The main topic of the tutorial video is to demonstrate how to perform a complete CRUD (Create, Read, Update, Delete) operation in ASP.NET using C# and SQL Server.

  • What are the three main steps mentioned in the video for setting up a project in ASP.NET?

    -The three main steps mentioned are creating a new project, designing the webpage, and creating databases and tables.

  • How does one create a new project in Visual Studio according to the video?

    -To create a new project in Visual Studio, one should click on the file menu, select 'New Web Site', choose 'Visual C#', select 'ASP.NET Web Site', set the location to save the website, and provide a project name.

  • What is the purpose of the GridView control in the context of this tutorial?

    -The GridView control is used to display the inserted records from the SQL Server database table in the ASP.NET webpage.

  • What is the name of the database created in the video?

    -The name of the database created in the video is 'programming db'.

  • What are the data types of the columns in the 'student info' table?

    -The data types of the columns in the 'student info' table are Integer for 'student id', NVarChar(50) for 'student name', NVarChar(50) for 'address', and NVarChar(50) for 'contact'.

  • How is the connection to SQL Server established in the video?

    -The connection to SQL Server is established by adding a connection in the Server Explorer of Visual Studio, providing the server name, authentication details, and selecting the database 'programmingdb'.

  • What is the purpose of the 'SqlCommand' object in the video?

    -The 'SqlCommand' object is used to execute SQL commands, such as inserting records into the database.

  • How does the video demonstrate updating a record in the database?

    -The video demonstrates updating a record by using an UPDATE SQL command within a button click event, setting the values for the fields based on user input from the webpage controls.

  • What is the method used in the video to display records in the GridView instantly after an insert operation?

    -The method used to display records instantly is by calling a 'load records' method that fetches data from the database and binds it to the GridView control.

  • How does the video handle the deletion of records?

    -The video handles the deletion of records by using a DELETE SQL command within a button click event, specifying the record to delete based on the 'student id' from a textbox.

  • What additional feature is added to the delete button in the video to prevent accidental deletions?

    -A confirmation message box is added to the delete button using the 'confirm' JavaScript function, which prompts the user to confirm their intention to delete before executing the operation.

Outlines

00:00

πŸ‘¨β€πŸ’» Introduction to CRUD Operations in ASP.NET

This paragraph introduces the tutorial on performing CRUD (Create, Read, Update, Delete) operations in ASP.NET using C# and SQL Server. The presenter guides viewers through setting up a new ASP.NET project in Visual Studio, creating a project structure, and designing the webpage layout. The focus is on creating a student management form with various controls such as labels, text boxes, combo boxes, and buttons to facilitate CRUD operations. The tutorial emphasizes styling elements and configuring the interface before diving into the coding process.

05:00

πŸ—ƒοΈ Creating and Connecting to SQL Database

This section discusses the creation of a new SQL database called 'programmingdb' and the setup of a table named 'student_info_tab' to store student data. The table includes columns for student ID, name, address, age, and contact details. The paragraph also covers how to connect SQL Server to Visual Studio using the Server Explorer, setting up SQL connections in the ASP.NET project, and preparing SQL commands to insert records into the database. Emphasis is placed on proper data types and initializing the connection string for database interactions.

10:02

πŸ–₯️ Inserting and Displaying Records in GridView

In this paragraph, the tutorial demonstrates how to insert records into the SQL database and display them in a GridView on the ASP.NET webpage. It covers coding the button click event to execute SQL commands that insert student details from text boxes into the database. The presenter addresses common issues such as ensuring the SQL connection is open before executing queries and troubleshooting syntax errors in SQL commands. The section concludes by showing how to load records into the GridView after insertion to immediately reflect the changes on the webpage.

15:03

πŸ”„ Updating and Deleting Records

This segment focuses on updating and deleting records in the SQL database through the ASP.NET interface. The tutorial explains how to set up buttons for updating and deleting records, and how to write SQL commands for each operation. It includes a step-by-step guide to modifying the student information in the database and reflecting these changes in the GridView. Additionally, the presenter introduces a method to confirm deletion actions through a client-side script, ensuring that users are prompted before permanently removing records from the database.

20:04

πŸ“Š Fetching and Displaying Specific Records

In the final part, the tutorial covers fetching specific records from the SQL database based on the student ID entered in a text box and displaying the results in the corresponding text boxes and combo boxes on the webpage. It explains how to use SQL data readers to retrieve data and bind it to the form controls. The paragraph also highlights the process of updating and deleting records with confirmation prompts, ensuring the application handles CRUD operations efficiently. The tutorial concludes with a summary of the operations performed and a call to action for viewers to subscribe to the channel.

Mindmap

Keywords

πŸ’‘CRUD Operation

CRUD stands for Create, Read, Update, and Delete, which are the four basic functions of persistent storage. In the context of the video, CRUD operations are the primary focus, demonstrating how to implement these functionalities in an ASP.NET web application using C# and SQL Server. The script describes the process of creating a project, designing the user interface, and coding the backend logic to perform CRUD operations on a database.

πŸ’‘ASP.NET

ASP.NET is a web application framework developed by Microsoft that allows developers to build dynamic web sites, applications, and services. In the video, ASP.NET is used as the platform to create a web application that performs CRUD operations. The script mentions creating a new ASP.NET web site project and using ASP.NET features such as GridView to display data.

πŸ’‘C#

C# is a programming language developed by Microsoft as part of its .NET initiative. It is one of the main languages used in the video to write the code for the web application. The script includes examples of C# code for connecting to a SQL Server database, executing SQL commands, and handling events in the ASP.NET application.

πŸ’‘SQL Server

SQL Server is a relational database management system developed by Microsoft. It is used in the video to store and manage the data for the web application. The script describes how to create a new database and table in SQL Server, as well as how to connect the database to the ASP.NET application.

πŸ’‘Visual Studio

Visual Studio is an integrated development environment (IDE) from Microsoft that is used to develop applications for various platforms. In the video, Visual Studio is the tool used to create the ASP.NET project, design the user interface, and write the C# code for the application. The script mentions opening a new website project in Visual Studio and using its features like Server Explorer.

πŸ’‘GridView

GridView is a server control in ASP.NET that is used to display and manipulate data in a tabular format. In the video, GridView is utilized to display the records inserted into the SQL Server database. The script describes adding a GridView control to the ASP.NET page and using it to show the results of CRUD operations.

πŸ’‘TextBox

TextBox is a standard control in ASP.NET used to capture user input. In the script, TextBox controls are added to the web page to allow users to enter data such as student ID, name, address, and contact information, which will be used in CRUD operations.

πŸ’‘DropDownList

DropDownList is another ASP.NET control that provides a list of options from which the user can select. In the video, a DropDownList is used to select an address, one of the fields in the student information form, providing a user-friendly way to input data into the application.

πŸ’‘Button

Button is a control in ASP.NET used to initiate actions or events. The script describes adding buttons with different functionalities, such as 'Insert', 'Update', 'Delete', and 'Get', which correspond to the CRUD operations that can be performed on the database.

πŸ’‘SQL Injection

SQL Injection is a security vulnerability where an attacker can insert or 'inject' malicious SQL statements into an input field for execution. Although not explicitly mentioned in the script, the concept is relevant when discussing database operations. The video demonstrates the importance of safely handling user input to prevent such vulnerabilities.

πŸ’‘Connection String

A connection string is a sequence of characters that specifies information needed to connect to a database. In the video, the script describes setting up a connection string to establish a link between the ASP.NET application and the SQL Server database, which is essential for performing CRUD operations.

Highlights

Introduction to complete CRUD operations in ASP.NET with C# and SQL Server.

Steps overview: creating a new project, designing the workpiece, creating a database and table, and connecting SQL Server with Visual Studio.

Detailed walkthrough of creating a new ASP.NET web project in Visual Studio, including project setup and initial configurations.

Designing the form: Adding a table with labels, text boxes, combo box, and buttons to perform CRUD operations.

Setting up the SQL Server database, creating the database 'ProgrammingDB' and the table 'student_info_tab' with appropriate columns.

Connecting Visual Studio to SQL Server: Adding a SQL connection string and writing SQL commands to insert records into the database.

Implementing the insert operation: Writing C# code to insert student records into the SQL Server database.

Fixing common errors such as connection issues and SQL syntax errors during the insertion process.

Adding a GridView to display inserted records from the database in real-time within the ASP.NET application.

Implementing the update operation: Writing C# code to update student records based on student ID.

Implementing the delete operation: Writing C# code to delete student records and confirming the deletion with a client-side prompt.

Enhancing the user experience by adding a confirmation prompt before deleting records.

Implementing the search operation: Writing C# code to retrieve and display specific student records from the database.

Final testing: Inserting, updating, and deleting records, and confirming that all CRUD operations are functioning as intended.

Conclusion and user guidance: Final remarks on the tutorial and encouraging viewers to subscribe for more content.

Transcripts

play00:00

hello viewers welcome to programming gig

play00:02

i'm here with a new tutorial that is

play00:05

complete crude operation in asp.net

play00:07

c-sharp with sql server

play00:21

[Music]

play00:25

complete crude operation in asp.net

play00:27

c-sharp with sql alpha

play00:29

follow the system first one is create

play00:30

new project second one is design the

play00:32

workpiece

play00:33

and third one is create ddbs and table

play00:37

fourth one is connect sql server with

play00:40

visual studio

play00:42

it can be 10 or 15 or somewhat

play00:45

for 510 is the right code too far from

play00:47

crude operation in

play00:49

asp.net with sql okay

play00:52

so start visual studio

play00:54

[Music]

play00:56

yes it's starting click on file menu

play00:59

open new

play01:00

website yes select visual c sharp in the

play01:04

left fan

play01:05

and select asp.net web from site

play01:09

select the location where you want to

play01:12

save this website

play01:14

web from site okay this is the location

play01:16

project c

play01:17

shop confolder and food backslash

play01:20

and then for the project name my project

play01:24

name is crude tutorial

play01:26

click on ok

play01:29

yes my project is created this is

play01:31

default text in asp.net

play01:34

so now i'll remove the default text and

play01:37

i'll design

play01:38

this page to perform complete crude

play01:42

operation in c shop with asp.net okay

play01:45

first of all deep

play01:46

and in this tip i'm just adding div

play01:50

style font size

play01:54

font size is large xlrs because the this

play01:58

div will use as title of the page

play02:02

okay that is student info manage form

play02:06

now make it align it center

play02:10

align equal to center okay

play02:14

now add a break then

play02:18

i will add a table table row

play02:22

six rows and column three columns

play02:26

okay now

play02:31

i'll add

play02:31

[Music]

play02:35

label and text box combo box and button

play02:38

control to perform crude operation okay

play02:40

so student id is to the name address ace

play02:44

and contact

play02:46

[Music]

play02:48

okay now

play02:51

go to the toolbox

play02:54

and in the toolbox add a

play02:59

text box control just drag and drop it

play03:02

in the paste default aspect space

play03:05

and since the font size

play03:09

font size medium yes

play03:13

resize this text box and just copy this

play03:15

text box

play03:17

for a student name and addresses

play03:20

drop down list to add address

play03:24

and ages attack 3 and contact is

play03:27

textbook 4.

play03:28

finally for tab control to

play03:32

add one more row in the table

play03:35

and button text is a insert

play03:40

for color white

play03:42

[Music]

play03:44

font size on both true and font size is

play03:47

medium

play03:49

okay now the

play03:52

back colors in the back oh this is

play03:54

border color back color select back

play03:56

color

play03:58

yes the color is purple now this is

play04:01

looking nice

play04:06

now go to the button click event

play04:12

add a grid view this grid view will be

play04:16

used to display the inserted records in

play04:18

the sql server database table

play04:20

in asp.net okay

play04:23

this is the grid view i just added

play04:32

now so that this is the button click

play04:34

even i will write code

play04:35

to insert records and that's what i

play04:37

wanted to be stable

play04:38

so let's go to the sql server

play04:43

this is sql server 2014

play04:48

sa password transfer authentication

play04:50

password database

play04:52

new data create new database my database

play04:56

name is programming db okay click on ok

play05:00

yes the database is created you can see

play05:02

the programming db is created

play05:04

and there is no table yet now i'm going

play05:05

to create a table

play05:09

column name is student id data type is

play05:12

integer

play05:13

and the student name data type is and

play05:16

worker

play05:18

50 and then address agent contact okay

play05:21

so insert more column address and worker

play05:26

is ages plot and contact

play05:29

contact is n worker plot means it will

play05:32

allow

play05:33

decimal set primary key in the student

play05:36

id okay

play05:37

name the table table name is student

play05:39

info underscore tab

play05:41

click on ok yes my table is created

play05:45

replace this table folder and the server

play05:48

explorer is the table is created

play05:51

go to the server explorer in

play05:55

your visual studio and right click add

play05:58

connection

play06:00

to connect the server server name

play06:03

authentication username essay and

play06:05

password just go through education

play06:07

password database name is programmingdb

play06:09

click on ok

play06:10

yes let's add it now this is the s17 for

play06:13

underscore tab you can see in the

play06:15

uh server explorer so to connect to the

play06:18

sql server first of all

play06:20

uh add sql connection skill connection

play06:23

con equal to new sql connection

play06:25

mysql connection is that to use sql

play06:28

construction you should add namespaces

play06:29

in system.data.sql

play06:31

client mysql connection is right click

play06:35

property yes this is the connection

play06:37

listing just double click to select copy

play06:39

and paste in the double quotation

play06:41

okay you can see id is essay and

play06:45

okay now it's called command com equal

play06:48

to

play06:49

new sql command mysql command is to

play06:52

insert records in the specifications

play06:54

table

play06:55

so insert into student info underscore

play06:58

this is the table name in the sql server

play07:00

values values restaurant id name

play07:03

addresses below

play07:04

i'll get from the control what i added

play07:07

in the default.spx page like

play07:10

textbooks12 and comma

play07:13

drop down list okay so i just

play07:18

put the syntax only now

play07:21

student id next zero

play07:24

first column is student id from text box

play07:26

one

play07:27

textbox one so and

play07:31

student name tag goes to address drop

play07:33

down list

play07:34

add the drop down list item list item i

play07:37

just uh

play07:39

put three item usa canada and uk

play07:45

okay the drop down list item is added

play07:48

edge is staggering theory and contact is

play07:49

tiger store so

play07:51

just put the control name

play07:54

a student id for

play07:57

student id is integer type so it should

play07:59

be converted to integer so integer dot

play08:02

first type of sound or text

play08:04

and then the student name is and worker

play08:06

so just for

play08:07

textbooks2.txt yes

play08:12

and then address addresses

play08:16

uh drop down list one dot selected value

play08:18

this is also an worker so

play08:19

just under download standard selected

play08:21

value and is ages plot type so you

play08:23

should convert it to double double dot

play08:25

for

play08:27

text titles three dot text

play08:31

and finally contact contact is

play08:35

textbooks4.txt

play08:37

[Music]

play08:38

okay it's done now initialize the

play08:40

connection string

play08:42

comma and con

play08:45

okay now just uh to

play08:50

first of all let's uh check the records

play08:54

and the field yes see that age is plot

play08:58

type

play08:58

so i have converted to double

play09:03

yes you can see double dot for text

play09:05

three dot text

play09:07

okay now

play09:09

[Music]

play09:11

com mysql command com dot execute

play09:14

non-query

play09:17

finally it will display the message

play09:19

after completing the execution operation

play09:21

successfully the message will be

play09:25

successfully inserted to display the

play09:27

messages in as

play09:28

pop-up just to write this code discrete

play09:31

manager dot register

play09:32

starter script this this dot get type

play09:36

script and then alert alert message will

play09:39

be

play09:39

successfully inserted it will display

play09:42

only the message is successfully

play09:44

inserted and then comma two

play09:47

okay it's done

play09:51

now the different viewing browser right

play09:54

click and view in browser the

play09:55

default.spx space

play09:59

okay student id 101 student name john

play10:01

usa

play10:02

h25 contact oh it's displaying an

play10:06

executive

play10:07

requires an open and available

play10:08

connection the connection system

play10:10

currently

play10:11

is closed so i have to open the

play10:13

connection

play10:15

just for con dot open and after

play10:17

completing the execution operation just

play10:20

for con dot close

play10:22

[Music]

play10:23

okay now reload space

play10:27

and photo record once again

play10:31

insert login failed for

play10:34

sa let's check the connection string

play10:39

these are these assets okay but password

play10:41

is look like a star so you should

play10:43

forward your original password

play10:47

reload this page again

play10:51

and correct syntax near the keyword into

play10:54

let's check the command sql command

play10:57

insert for t and check the

play11:00

whole command from beginning to end oh

play11:04

yes

play11:05

there is a comma extra comma just remove

play11:08

this comma

play11:09

yes now

play11:14

this page again and insert the record

play11:16

once again

play11:18

insert yes successfully inserted but

play11:20

this result is not displaying in the

play11:22

grid view instantly so

play11:24

to display the result in the grid view

play11:26

instantly

play11:27

i should add a method but the records

play11:30

is inserted successfully in the specific

play11:32

database but not displaying the

play11:34

grid view so to display the records in

play11:37

the grid view

play11:38

i'm gonna add a method

play11:43

so void method name is load

play11:46

record

play11:47

[Music]

play11:54

okay method name is load record now

play11:56

place the connection listing out of

play11:57

events so that

play12:00

it can be used in any event

play12:03

in this page so this is out of event

play12:08

connection connect sql connection is in

play12:10

out of event so

play12:12

now just put command no need to write

play12:15

sql connection

play12:16

again in this method so my command is to

play12:18

select all the records in the grid view

play12:20

skill command comma continues in sql

play12:22

command select star from

play12:25

a student in for underscore tab the

play12:27

table name

play12:28

initialize the connection string con

play12:31

yes this is the account connection

play12:35

listing i can used

play12:39

so now it's the date adapter d equal to

play12:41

new sql data adapter

play12:43

com

play12:47

then a data table

play12:52

data table dt equal to

play12:55

new data table

play12:56

[Music]

play12:58

to add data table you should add numbers

play13:00

using system.data

play13:03

okay now d dot field dd

play13:06

this is the actual data adapter and it

play13:08

is predictable

play13:11

finally you beyond the data source equal

play13:13

to dt

play13:15

and then we'll be under data bind

play13:18

[Music]

play13:19

okay now i'll call this method in the

play13:24

uh click event all over all button click

play13:26

event and

play13:27

[Music]

play13:29

as well as phase load event okay

play13:32

to uh add method in the page dot event

play13:35

you should add

play13:37

not is false back if not is false back

play13:40

then load records

play13:42

yes the record is displaying in the grid

play13:44

view perfectly

play13:45

now i'm gonna insert one more record and

play13:47

the result will be displayed in the grid

play13:49

instantly

play13:50

yes it's successfully inserted and

play13:52

displaying the grid view instantly

play13:55

okay

play13:58

now add one more button just copy this

play14:02

button

play14:02

and paste yes this button controller

play14:06

used to update

play14:08

records based on student id text is

play14:11

button text is update

play14:14

and go to the events uh

play14:18

property event remove this previous

play14:20

event and

play14:21

double click on click

play14:25

yes the event is created now just copy

play14:27

the

play14:28

insert button code

play14:32

yes now this is a

play14:35

insert command now i'm gonna put update

play14:38

command

play14:39

just put update is 24 tab and then set

play14:46

[Music]

play14:48

set student name instant name is second

play14:52

column

play14:52

is to the name equal to for the syntax

play14:55

single quotation double question and

play14:57

then plus sign

play14:58

okay name from techniques to dot text

play15:02

and then address just copy

play15:06

and paste yes this is for address

play15:09

address equal to

play15:11

drop down list one dot selected value

play15:14

[Music]

play15:16

okay then is aj's

play15:20

float database data type is plot so you

play15:22

should convert it to double

play15:24

double dot first tag three dot tags

play15:27

[Music]

play15:28

okay now contact

play15:31

contact equal to textbook four dot text

play15:34

contact that from technical dot text

play15:38

higher you should add ir student

play15:41

id equal to its integer type so integer

play15:45

dot first techniques one dot text i mean

play15:47

if you

play15:47

put id one zero one it will update one

play15:50

zero one's

play15:51

name address is and contact

play15:55

okay initialize the connection string

play15:57

con

play15:59

okay now it's done com dot execute

play16:02

non-query okay contact close

play16:04

okay now finally message change the

play16:06

message

play16:07

message is successfully updated after

play16:10

executing the operation it will display

play16:11

message successfully updated

play16:13

okay save and go to the browser

play16:17

reload the space yes yes yes

play16:21

the button is displaying now i'm gonna

play16:23

add update

play16:25

101 records now name is

play16:28

john so i will update it

play16:32

to john simon

play16:35

and addresses usa i just put canada

play16:38

is 25 to 30 and contact

play16:42

contact uh two

play16:45

successfully but you can see that the

play16:47

student name addresses and contact is

play16:49

updated successfully

play16:51

okay now replace this

play16:55

table yes you can see john simon cannon

play16:59

that

play16:59

the record is updated in the

play17:03

copy specific button and face to far

play17:05

from

play17:06

delete operation the property

play17:10

change the text text is

play17:14

delete okay and go to the event

play17:18

this is button to click events and now

play17:20

i'm gonna create a button three click

play17:22

event yes

play17:22

this is the new button click event okay

play17:28

uh just copy this code and

play17:31

first in button 3 click event just uh

play17:35

change this code this is this button

play17:37

control i'll use to

play17:39

perform delete operations so statement

play17:41

is delete

play17:42

student in four tab only higher

play17:46

yes higher student id equal to textbox

play17:49

one dot text

play17:51

initializing connection string on ok uh

play17:54

execution

play17:55

click under close when message message

play17:57

will be successfully

play17:59

deleted okay it's done and just calling

play18:02

the method load records

play18:03

save this uh application okay

play18:08

now i'm gonna delete one zero one record

play18:11

just click on delete

play18:12

yes successfully you can see in the data

play18:15

again in the grid view the records is

play18:17

also removed from the grid view

play18:20

okay now

play18:24

add in the button control to perform

play18:26

charts operation

play18:27

so change the text of this button

play18:31

button is charts volume of the event it

play18:34

will be the new click event

play18:36

and the text will be charts

play18:39

text is charts okay

play18:42

now now we're gonna click yes

play18:46

[Music]

play18:48

okay now

play18:52

you can only use the load record method

play18:55

and if you use the load record method

play18:57

it's displaying all the records

play18:58

and now i'm going to show how to add

play19:00

higher close and display the specific

play19:02

records uh from the switzerland database

play19:04

to the

play19:05

grid view so my statement

play19:09

is select star prom is turned in for tab

play19:12

higher

play19:13

student id just copy from the previous

play19:17

button click event

play19:18

student id equal to integer dot first

play19:21

technics one dot text

play19:22

yes it will display that records which

play19:25

says student id is

play19:26

based on the textbox wonder text

play19:30

okay save and reload this page

play19:35

first of all i'm inserting one more

play19:37

records yes successfully inserted

play19:39

now one more records

play19:44

sarah yes successfully started now

play19:47

uh charts 103 yes it's displaying only

play19:50

103

play19:51

foot one through two displaying 102

play19:53

records only

play19:55

okay now i'm gonna add one more

play19:58

button this button controller used to

play20:01

get data from exclusive database to text

play20:04

box and combo box from xbox one

play20:06

okay remove the button click event

play20:10

yes now

play20:13

[Music]

play20:15

copy this sql command

play20:19

and paste it in the button five click

play20:21

event

play20:22

yes select a start from a student in

play20:25

front of a score tab it's not radical to

play20:27

just type

play20:27

1. text okay now open the connection

play20:30

conduct

play20:30

open and then sql dated after data

play20:33

reader

play20:34

sql data reader r equal to com dot

play20:36

execute data

play20:40

okay then file r dot read then

play20:48

it should for just index tables two dot

play20:50

text equal to

play20:52

r dot get value that value index uh

play20:55

name index is one dot twisting let's

play20:58

check

play20:59

the index in the switcher to be stable

play21:02

you can see student id is index zero

play21:04

student name index one is

play21:05

address index two is index three and

play21:08

contact is index four

play21:10

so i will put index based on the column

play21:14

take this to index one

play21:17

and uh contour name is textures2

play21:23

now just copy

play21:27

and paste

play21:32

address is uh from drop down list so

play21:34

four to drop down list one dot selected

play21:36

value equal to

play21:38

address index is two get value two dot

play21:42

twisting and age is still

play21:45

three and index is three

play21:50

and contact is four and index is four

play21:54

okay now it's done save

play21:57

all and then reload this page

play22:01

[Music]

play22:07

okay put one zero two just click on get

play22:11

yes it's displaying all the records

play22:15

based on product student id

play22:18

i just update and

play22:22

now if 101 yes john usa 25 e402

play22:27

testing i can add 23 okay

play22:31

it's working fine

play22:33

[Music]

play22:37

delete successfully deleted delete is

play22:39

confidential if you delete the records

play22:40

you cannot get back this record so i'm

play22:42

gonna add confirm masses to execute

play22:44

delayed operation so

play22:46

go to the tools and just write some

play22:49

codes

play22:50

this is on client click event just

play22:53

put on client click equal to

play22:58

return confirm

play23:02

then first break single quotation

play23:06

are you sure to directly display my

play23:07

access are you sure to delete

play23:10

okay it's done just write this

play23:14

uh code in the on client click then it

play23:16

will display the message before

play23:17

performing the executing operation

play23:19

okay now i reload this page

play23:23

and now just uh

play23:27

photo102 and click on delete

play23:32

so we'll get yes delete are you sure to

play23:35

deal with this will match that issue to

play23:36

delete if you

play23:37

click cancel it will display nothing and

play23:39

it will do nothing but if you click

play23:41

ok then it will delete successfully

play23:46

[Music]

play23:48

yes it's working fine

play23:51

now i'm gonna just update this energy

play23:54

update updated successfully and the name

play23:57

also updated

play23:59

are you sure to delete cancel no yeah

play24:01

okay

play24:02

yes successfully deleted thanks for

play24:05

watching this tutorial if you like this

play24:06

video please subscribe my channel

play24:19

[Music]

play24:50

you

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
ASP.NETCRUDC#SQL ServerWeb DevelopmentTutorialDatabaseCodingVisual StudioProgramming