DATA INSERTION IN MYSQL IN C# VISUAL STUDIO 2022 | C# SAVE DATA IN MYSQL DATABASE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to my Channel today in this video tutorial we are going to learn about inserting data into my schedule database in c-sharp so first I will show you the database so if uh I have started this exam Apache server as well as this uh MySQL so if I go here and if I show you this student table so we have this ID student name and student fname and student address here now this ID is auto increment it so we do not need to exert this so we will insert only the student name fname and student address so for that I will come to visual studio and first we will add in the driver for MySQL so for that I will come to this tools and here I will search for new get package manager and I'll click on this now I'll go to browse in here I'll search for my cable dot data and now I'll click enter now it has shown me this uh various drivers so this this first one is our driver so I'll click on this and now I'll install this now if it it will take some time to install this now it is asking me to accept this so I'll accept this and now it will complete its installation so now the installation is complete so if I go to this install tab now you can see mysql.data here so it is successfully installed now I will come here to toolbox and I will drag in the uh text uh box on Dragon attacks box yeah now I'll duplicate this wall with control and drag it down and click control and drag it down it again now I'll expand it a bit so I'll expand this as well so this one as well and now I'll go to toolbox and look for search for a button so B button and I'll drag it this two now all uh right click on this and go to properties so it will show us the properties here so I'll use here insert now I'll click on this all the fix it here now I'll double click on this to create this click even now it's click event is created so we will create the connection strand first row string server equals as we are using a local database so I will use local host an output semicolon here then it takes the string uid so uid is uh the database user so we are using the root user so I'll use root then it takes this password for the database so um password equals um empty because we are not using any password on this user root user and string database so database is a equal to our test DB if I show you this test DB so if I go here now it is called operations not test DB so I'll copy this and Ctrl C this and now I'll go here and now I'll put double quotes and control V8 and I'll put semicolon at that end now this is created so now we will get our connection strings or string on a string equals and it takes first the server server because uh equals plus server then plus double quotes semicolon and then we will use uid equals plus uid a sub double quotes semicolon and then is a password which is PWD equals plus password and plus then double quotes we need semicolon here and then we need the database so database and we will use Plus data base and output semicolon at end of it now our connection string is uh created now I'll close this window so we have some more space and now I'll create the connection so MySQL connection con equals to new MySQL connection and then I'll put here this and we will send constant here on string don't put semicolon here I'll remove this these two do not need them so now for connections string is created so we will open this connection um on dot open that is it already suggesting us now we will use my schedule but first to ask you will command we need a query so string query equals uh insert N2 then the table name so is TD above this is the table name if we if I show you so STD table is our table name okay then we have ID is R2 incremented so we we will answer this student name student further name and student address so for that I will come here again and this T is small so I'll make this small and now I'll use here uh name comma name a gamma is a d f name comma STD address and I will close this and then we will use values and then values will come so I'll close it down again now I'll put semicolon here and now here I will use a single code single quote because we are inserting more card value based then double quotes and then plus plus and here we will use text box one dot text then we will use here comma then single code single code then double quote double quote then plus plus and then text box to Port text and my single code single code then we'll go to double quote then plus plus and then text box three dot text and this is done so now I'll put a semicolon at the end query is complete so I'll use here and my s cable command uh CMD equals new my schedule command and if x the query foreign and now I'll use a end I equals CMD dot execute and QD and now I'll use uh if I is greater than minus 1 then message box dot show data accessibility inserted and now I'll put semicolon here now our code is complete so if I quickly run this now it is running so if I enter here uh Ali Ali and yeah event uh on an address shower and now if I click on this insert that we will see we have ah format of initialization does not uh confirm to specifications starting at index so now if we look at the connection string here so we have an extra semicolon here so I'll remove this and now if I run it again and now if I insert something uh name Ali and for the name on and address shower and now if I click on insert so data successfully inserted now our logins or this okay I will insert it a few times insert again and I'll click ok now we will go to our database so I'll come here to this and now if I click on then this is to the table so now you can see for time this data is inserted into this table so I think that's all for today I hope you liked the video if you like the video please like subscribe and comment thank you
Info
Channel: Programming Guru
Views: 3,359
Rating: undefined out of 5
Keywords: Data insertion in mysql visual studio, insert records in mysql c#, visual studio Mysql, Mysql visual studio, mysql visual studio connecction, c# mysql connection, mysql, mysql dataabase in c#, c#, csharp, insert data in mysql database in c#, Visual Studio MySQL Connection, visual studio mysql connection tutoiral, c# mysql data insertion example, insert rows in mysql in c#, insert data in mysql in vs, data insertion in mysql in c# visual studio 2022, C# SAVE DATA IN MYSQL DATABASE
Id: mWGUcasaQcE
Channel Id: undefined
Length: 10min 58sec (658 seconds)
Published: Thu Nov 24 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.