CONNECTION TO MYSQL IN VISUAL STUDIO 2022

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome in this particular video tutorial i'm going to show you how to connect to my sql data to my sql from visual studio 2022 so let's get started the first thing you are supposed to do fire up your visual studio 2022 as it is starting just go to create a new project click on that let it uh let us wait for it to download templates from this particular drop down menu ensure that you select the c sharp then under these categories of different [Music] applications that you can develop just to go and look for the application called windows windows form application click on that then click next here give you a project the project name whichever name that you want in this case i'm going to give it a connecting and connecting to my sequel that is the project lemma given it then the most important thing in this particular video tutorial under the location where you are going to store your application ensure you know it for mine it is under the users this folder is going to be very critical when we will be doing later connections so ensure that you mark clearly where you've stored this is the part that we are going to need so click next and let us wait for it to create for us uh the solution then here under frameworks you can uh that those are the ones which i have available for now if you have others that you are interested in feel free to select them now click on create and let us wait for the project to be created after the loading is complete well i want you to drag a pattern from under the toolbox drag it to the design form after that go to the pro while the pattern is selected go to the properties and i want you to change this label i need to to testing testing my sql connection that is what i want to to then it enter resize so that if the text appears so nicely there and the one thing i want to change is uh the font size so that you can see it clearly i want to go with that one but bold then increase the one to maybe 20 that one seems to be okay testing my sql connection with that now in place one thing you need to do it is to go to the tools menu over here then you go under the no get package manager and i want you to look at the manager look at package solutions select that and another thing to notice it is opening ensure that your internet the connection is there so go under the browse tab whereby i want you to search what we call type in my sql my sql the first option we want we have here this one is the one i'm interested in my sql.data if you click on it on the left side of the side pane here you will see it has been highlighted as my sql data than the version but the key thing you the information you are getting it is that it is not installed in this particular application so that is what i wanted you to verify that for this particular project it has not been installed so the first thing i want you to do is to head over to this address and all the links that i'm going to be using here i will leave them under the description below so go under this particular open up your browser and on your address part just enter that particular address there so you will see that this is the library which is going to which is from the nougat so it is going to enable you to connect your dot net languages to my sql database so the first option i want you to go to the net cli so this is the option i'm interested in this is the option i'm interested in copy this particular you can copy that particular command from there remember i told you that you must be very careful with where you are saving when your application to so now you get to where you've saved my mine i've saved it under documents where the folder called dvs 2022 and this is the folder i'm interested in open it and under this particular folder still open it now on this particular location i want you to type cmd then hit enter it will open the command prompt the window starting from that particular application so since i've copied this particular address from here using this particular shortcut so go to the command prompt and right click what i've done up right click then it has pasted that particular command so on your keyboard press enter wait that command will configure your application with uh the sql so that is uh it has completed successfully once you get here it means that it has completed successively to verify that this mysql data has been installed successfully to your project just to go again here you can see it has not changed now i want you to maybe you can re-look for it here also type again my sql you enter it it will do the search now if you come back here the version which has been installed it is 8.0.29 which corresponds which corresponds to the version that has been which was here on the command prompt with that in place uh now you are good to connect your c sharp application to to my sql so close that i want you to double click this particular pattern that you've created and it will take you and it will it will bring you to the event click but on top of this i want to to copy the following to copy to paste the following command to paste the following line which is using my sql.data client copy that and paste it on your application there after you've done that because i pretty much have done that this particular work before one thing so copy this particular piece of code and paste it under the click event of the pattern so i'm going to test it for the interest of time and one thing i want to emphasize here it is that under my this is i'm using the localhost here so you feel free under this localhost you can put the id address if you are on the network network the environment you can put the id address of you where you are my sql server is installed the other one under this i'm using i'm using localhost i have a database called school then the other my username it is root then i don't have the password remember to escape this double quotes there which are [Music] which are which are which are placeholders for the password so save your work after you've saved it you ensure that your exam control banner or you are my sql in this case i'm using the example so i'm going to start it so as you can see my sql already started on my own and it is listening on port 3305 with that started now you can go back to your visuals to audio 2022 and run the project let it compile and let's wait for testing okay the project has combined successfully so you can click on this particular pattern of testing testing my sql connection so you can see it has told me that the connection is open and if you go to my local host i want to work in the local host to verify that i have got that particular database in place so that you go to phpmyadmin yes it has opened and this is the database i've been talking about you can see i have what the database set up but we can also change and create a new one let us say the database name let us change it to my sql test test you can create that and now after you've created that my sql test it it will be empty so go back to your visual studio first just make sure you terminate the application there and then you can change these changes to whatever your database name is for that case i'm copying that change this to [Music] my sql test save it after you've saved go back run the application after you run the application let's wait for it click again on testing in my sql connection you see this pop-up window come and the connection is open so let's see when you close this particular my sql server i've closed it i want to close it what will i upend so yes i want to close it [Music] having uh let's ensure that it has been closed yes it has been closed so go and eat the connection there this time around what is the message yes and cannot open connection so that is how you basically is that that is basically how you connect to my sql database from the visual studio 2019 20 22 once again let's test the connection we have started it you can see this running and listening on 43 zero so click on this particular the pattern it tells you that the connection is open so basically that is how you connect to my sql server from visual studio 2022 it is my hope that this particular video has been informative and educated and educative one thing that i like from you it is to give me a subscription a like and also share it with your friends and also don't forget to hit the notification bell so that when i do this new video tutorials you are the first one to get the notification and watch them bye and thanks for watching
Info
Channel: programminghub
Views: 59,216
Rating: undefined out of 5
Keywords: visual studio 2022, mysql, c#, database, application, database connection, dotnet add package MySql.Data --version 8.0.29, MySql.Data, NuGet, https://www.nuget.org/packages/MySql.Data/8.0.29?_src=template#versions-body-tab, sql, how to connect to mysql in visual studio 2022, using MySql.Data.MySqlClient;
Id: HOdJUMlc4ZM
Channel Id: undefined
Length: 16min 57sec (1017 seconds)
Published: Wed Jun 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.