Simple CRUD Operation Asp.Net c# With SQL Server | swift learn

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my channel swiffland in this tutorial i will show you how to perform complete crude operation insert delete update and charging in asp.net c-sharp sql if you don't subscribe my channel yet please subscribe and press the bell icon for upcoming videos okay let's start visual studio this is business 2015. you can use 2019 okay now i'm gonna create a new website too far from crude operation select asp.net web home site in visual c shop select the location where i wanna clear this website our name is t and i'm just creating a folder creating asp click on yes to clear this folder because this folder is not available right now so i'm gonna create this new folder and then click ok yes the website is created let's take crude in asp in this folder the website is created okay now this is the default deep tag and attribute i just removed all tag and attribute now i'm going to design it newly first of all i just started deep and the style of this db's style equal to fading fading 15 pixel okay for the design yes this is the design you can see it's padding added and the top left right also now i'm going to creating a table with eight rows and two columns okay the table is created now mars cell yes i'll write title of the space that is complete crude in asp.net with sql okay [Music] now select the td table definition and click on style in the property font size is x large okay and fontboard true font-weight bold and color change the color color is yes this is looking nice now i'm going to design this page webpage with level control text box uh button control okay first of all this is the level control uh text is first of all font size change the font size font size is uh medium yes and text text is employee [Music] id okay it's done now just copy this level control and paste for employee name address and other call other column [Music] okay now say the text of the second level control text is employee name and turn cd first one is ace sex and joining date finally contact okay now i'll add the control from the toolbox for relevant field employee id name cds6 date and contact okay first of all i just added a text box size is medium font size is medium okay and resize the text box white white is 200 pixel yes now this is looking nice okay now copy this text box control and face for name and add a drop down for cd okay font size change the font size font size is medium and white white is 200 pixels so that it's all the controls weight is equal right 200 pixel okay and ace text box three and then sex sex from ready button list i just added radio button list eight items uh there are two items first item is mel and second one is for female okay now click on ok yes melody humility now this is a align where the direction is horizontal now i will change the refeed direction as horizontal the voltage vertical i just change it with horizontal okay now joining date this is textbook four contact status five okay now add button control from the toolbox [Music] just drag the button control and drop it in the workpiece now design this button control white is 100 pixel and font text text is insert this button controller i'll use to perform insert operation so one word true okay for color four colors white and the back color of this button control back color back color is yes yes by color [Music] yes key black okay now this is looking nice and i'm gonna adding grid view control to display result after executing after execution of the operation click button one click event okay now design this grid view control first of all header style header style back color set the back color back color is yes and back color and four color change the four color as white yes okay now it's looking nice [Music] now for the grid viewing full row so marcel yes resize this review okay yes now it's looking very nice this is button click event i'll write code too far from the chat operation in button click event now this is the server my server name my sql server run the sql server management studio [Music] server name catalog hyphen sbl authentication exclusive application login essay and password disclosure authentication password now just click on connect yes it's connected i explain the database folder and now i'm gonna create new database [Music] database name is crude tutorial db click on ok yes my database is created you can see in this object explorer expand the table folder there is no table now add a new table yes column name i will put column name based on my web page design so there are six column mpid this is data type is integer emp name name name is embarka and cd cd is also and berger type is is explode and sex sex is also in vodka sex is only male and female there are only 5 to 10 characters so i just fixed it with 30. joining that is daytime contact is also an worker okay now set primary key in emp id column and table name table name is employee setup underscore tab click on ok yes the table is created now replace the table folder yes you can see the employee setup tab is added in the object as explorer table folder okay now right click on the table and edit of 200 rows now i'm going to insert one records digitally stable so emp id emp id is 101 mp name is john smith and cities new york [Music] no cities chicago age 25 sex maryland joining date first january 2021 contact now blah blah okay i just inserted a record to confirm that my table is working for faculty okay now go to the development from visual studio go to the server explorer now i'm gonna connect the database in server explorer first of all select the server name server name all right server name my server name is catalog hyphen as where you can see authentication is exposed authentication and username is oh no yes select exclusive authentication if the name is safe password is sql server authentication password [Music] select the database my database name is crude tutorial db okay test connection succeeded then click ok yes now expanded database for the table folder yes this is employee setup tab and you can see that columns also displaying the database table what i already added now let's match emp identity h6 during dating contact for hiring that design also same okay now to connect with the sql server first of all write sql connection call connection equal to new sql connection add name space is in system.data.description yes the name species edit now you should put connections in the double creation and sql connection so right click on the database in the server explorer click on property double click to copy the connection string and paste it in the sql connection double quotation okay now i'm gonna write this call command first of all you should open the connection string connection [Music] so uh let's check the control techniques one two and drop down list one add drop down list item for cds it is uh first one is chicago and second one is uh new york third one is los angeles and fourth one person is settle okay it's added anti-growth 3d redevelopment list 1 control id techniques 4 for our joining date and contact triggers 5. okay now i'm gonna declaring variable for the related control based on data type so that i can use this variable uh as con and control easily in the sql command okay so integer empty equal to integer dot first exam dot text understanding mp name equal to titles two dot text i mean text box to what text you writing textbooks to it will be around that mp name and cd for double list one dot selected value is ages data type is upload so i have to convert it to double so i'll declare it later now sex is string type so sex is equal to ready even list one dot selected value contact also wasting time parker worker time worker type so contact text box five dot text now the remaining one is uh emp id and data path joining date okay so uh ages plot type so i just converted to double double a is equal to double dot first equals three dot text and joining data joining date is date time so that time j date equal to date time dot parse textbooks four dot text okay now for tesco command mysql command is sql command command equal to new sql command sql command is to insert records in the database table so insert into employee setup underscore tab values values are as you can see uh values are emp id so my variable is emp id i just put variable with maintaining the sequence in the table mp id name cds extending date okay so emp id variable emp id and column emp name for column empty name i just i'll put a variable emp name [Music] you should uh noted that you should conscious about the syntax if you cannot put syntax accurately then it will not execute it will display an error okay mpidmp name then a cd is and sex then variable joining date joining date variable is jdate and contact contact is contact okay now it's done [Music] initialize the connection string connection okay [Music] now open the connection connection.open and then close the connection connection dot close okay now put command dot execute non-query execute non-query used to far from crude operation i mean insert update delete operation okay now after performing the execution successfully it will display a message successfully inserted so just for the message script manager dot register startup script this then this dot get type and then key key is script and then escape my script is alert single quotation first frequency information then the message successfully what message you write here it will display the message after executing the operation successfully saved okay true and now it's done now i'm gonna get a method to load data in grid view after performing the execution after performing the insert operation so what get employee list and then now sql command sql command command equal to new sql command to display the result with all the records needed to be stable just write the sql command select star from employee setup underscore television stable name and connection is sql server connection string connection okay then excel data adapter hd equal to new sql data adapter command now declare a data table data table dt equal to new data table you should add number space to use data table species in system.data okay now sd dot fail [Music] dt great view gdp migrate view id is elite b1 so we'll be under data your sequel to dt then we'll be under data bind okay now go to the spx page right click and click on view in browser [Music] yes now i'm gonna insert record id is 102 employee name name is trump cities new york is 55 sex male and joining date for turning day this is month day year format okay second january 2021 insert oh it's displaying an exception login field for user essay so let's check the connection string id is s8 okay but first what you should put your original sql authentication password okay it's done now save this [Music] change okay go to the browser and reload the space resend or another error incorrect syntax near one zero two i mean first column so let's check the sql command emp id values empi dmp id is 100 to so as well command let's check insert into mpid values yes yeah i i'm getting a mistake i didn't put fast break so you should put fast break yes now it's done i just added fast break and close the first break yes now put the records 102 name trump yes city new york age 55 sex mail okay date and contact click on insert successfully saved yes it's successfully saved call the method to display result in grid view i have created method but i did not call this method in the button one click event so the result is not displaying the grid view okay now i just call this method in the button click event and form load face load event as well [Music] in the asphalt.net you should add not even if not supposedly in the past load event okay now reload the space yes it's loading now you can see there are two records in the database table and it's also displaying the grid view in my pace okay [Music] now i'm gonna add one more button this button control i'll use to perform update operation text is update okay now it's done go to the event remove the previous event and uh double click to create a new event this is button two so the event is button to underscore click ok now i just copy the button one code because insert and update code is a bit same completely same just change the sql command this is insert command now i just changed it update command update employee setup tab the table name and then set set column name [Music] database table column name [Music] column name is emp name i will update emp name cd a6 joining date and contact based on emp id so set emp name equal to emp name variable emp name and cd [Music] cd equal to variable cd yes this is emp name column name emp name and variable emp name and ct column database table column name and this is city variable then double quotation single quotation comma and then is is equal to single quotation double quotation plus sign is and then as same as well sex sex equal to sex and joining date equal to dated then contact contact data vegetable column name contact equal to variable contact remove the fast break and now add higher clause however emp id equal to variable employee then it will update all the column name cds sex during date and contact based on emp id what in pmp id you put in empid variable i mean text box one okay now rest of the code is same command dot execution query connection dot close okay and now change the masses after executing the operation it will display the message successfully updated okay now call the method yes method also calling save right click new in browser let's test the code 103. now i just insert the records then i will update okay los angeles is 25 and mail joining date this is first january 2021 and this is contact yes successfully inserted now i'm gonna update a record i will update record one zero three mahad to christina and may sex smell to female just click on now this is mahad to christina and sex male 2 female now i will click on update then it will update it as a change contact also yes you can see 103 mohamed christina and this is female sex and contact also 015 okay it successfully working okay now i'm gonna add one more button control this button control i'll use to perform delete operation this is also same it will delete based on employee id so first of all since the text of the button control text is delete and then click event button 3 click event yes now copy the code from button to click event just uh i need one variable only emp id and then just uh sql command con dot open to then rest of the code okay now faced yes now change the sql command this button controller i'll use to fire from delete operations so sql command is delete employee set of underscore tab then only higher remove the code yes amply underscore tab higher emp id equal to mpid initializing the connection con dot execute non query then just change the message after performing this operation it will display the message successfully deleted and call the method yes done now right click view in browser to test the button three delay operation okay now [Music] for emp id mp8102 i'll delete one zero two just click on delete here successfully deleting you can see the records 102 also removed from the grid view to display confirm message before execution add code to far from confirmation so in the on client click in the button just click on client click write to return confirm first break close the first pick and then semicolon then in the first break for single quotation and then put your message my message is are you sure to delete because this is confirmation so are you sure to do it if you want to use it in the update you can use okay now view in browser test again now i'm gonna delete 103 your idc record 103 delete are you shooting is displaying the confirmation issue to get if you click cancel it's not delighted now if i click ok then it will be deleted and it's deleted successfully [Music] now i'm going to insert in one more record 103 in a family and yes click on insert yes successfully inserted 132 trump new york 55 ml okay yes it's also successfully inserted okay guys now i'm gonna add one more button control this button control uh to perform chart separation okay text is get yes now [Music] i will display the result based on uh emp id at least for the result records in the grid view based on empi employee id okay now go to the button click event yes this is button for click event just copy the code from the get employee list method because this is similar to uh a bit similar to method called okay now this is the variable i i just add the variable uh higher empide this is that table column name emp id equal to variable single quotation double quotation plus sign then just variable variable name is emp id it will display the result in the grid view based on the mpid so my variable name is emp id okay emp id now right click and view in browser if you see this uh tutorial consciously perfectly without escape you can understand this quote though i coffee faced [Music] okay i want you to get oh no i i didn't remove this confirmed message no need to confirm messages in this button so remove confirm message from on client click yes it's removed now save save change and view in browser again [Music] okay now put your employee id 102 click on get then you can see only one zero two record only two trump new york and the 55 is okay one zero three it's displaying one through three records okay it's done it's working fine now i'm gonna add one more button control this button control i'll use to perform charts i mean what uh result displaying at load at runtime and phase load it will display the result in the button five click event okay this is the default click event i just removed and now go to the button click event here you can just call the method or you can use you can copy all the code instead of calling method it's better to use method get employee list okay now reload this page [Music] code sample given the description box below you can see in the description box if you like this tutorial please subscribe and press the bell icon for upcoming videos lord it's displaying all the records in the great view and if you click on get with em employee id it's displaying only the records based on employee adding a grid view okay now i'm going to insert one more record this is employee id134 and print them sunday saddle 25 okay insert successfully insert it okay [Music] now i just change the city los angeles update successfully updated one reverse and los angeles if i change age 25 to 28 then it will update 20 yes it's updated as 28. okay if you are not delete just click ratio okay yes it's successfully deleted and once the records are not available 103 get yes it's displaying all the records if i click on the load button you
Info
Channel: Swift Learn
Views: 10,309
Rating: undefined out of 5
Keywords: swift learn, crud in asp.net c# with sql, asp.net tutorial, insert update delete in asp.net c# with sql server, crud in asp.net, crud in c#, insert update delete and search in sql server using c#, insert in sql using asp.net c#, search data from sql using asp.net c#, insert, update, delete, view, visual studio code, crud asp.net c#, virul, crud c#, c# tutorial, retrieve, simple crud operation in asp.net
Id: ORf1PiEdMik
Channel Id: undefined
Length: 30min 41sec (1841 seconds)
Published: Tue Feb 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.