How to connect phpMyAdmin MySQL Database in Visual Studio .NET Core C# Windows Form Application

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video I'm going to show you how we can connect to mySQL database in localhost that means we have phpmyadmin so we are going to create dotnet core Visual Studio C sharp application and connect to that database firstly I need to set up a database for that I will go ahead and install now normally a here I am using samp in my Mac so I will use samp in Windows also I will download this there are some latest version right so I can download this one which is the uh using the latest PHP version okay that is downloading and after installing that we can create our database now the thing is uh this works with the dotnet core if you are using.net framework better you can watch another video maybe I could do that in future but here I'm going to do this with DOT net core okay that is downloaded so I can open this click install I will press next next okay now we have to press allow access all right now I will press finish and it will uh start it I guess yeah it is a starter so I will press start Apache and then MySQL I will allow access for my SQL now all right now I can go to my local host forward slash PHP my admin that is it so here I'm going to create my database for our software I will select new the database name will be sample and then press create okay now we are not going to create tables in this video just we are going to connect with the database all right now I will press this create a new project as I told you we are not going to use dotnet framework here I will search Windows Form UAC multiple options but remember we are not going to use this.net framework but we are going to use this one a project template for creating.net Windows Form win forms app now I'm going to press next here I am going to save my project name as sample connection now press next here I will just go to create the project now okay now we are going to install some packages using nougat package manager to go to their go to tools and then go to nougat package manager go to manage new cut packages for solution here select the browse option and then type MySQL now result will be appeared but you cannot see because you had a scroll to the top otherwise you will not see the result because it is on in the top of the result so due to a bug go anything it is in the sum down now I will press install press ok accept all right now I'm going to search next package which is nougat Dot framework now if you search the result will appear but your head is called to the top and then this is the package select that and select your project here and then press install okay now to confirm whether these are installed or not here in this project in the solution Explorer View solution Explorer this one in this dependencies path you will see this packages inside that you will see this mysql.data and then nougat.framework okay now I will go to my form and then double click on my form now in the top before the name Space Project name I'm going to say using MySQL dot data Dot my a square client and then semicolon and after here let's uh code here in this Constructor or maybe you can do this coding in any way I'm just going to here so I will firstly create my connection string I will say this as MySQL this is MySQL right my Square con is equals to double quotations server is localhost now let me go ahead and show you how we can find the server name now if you go to the PHP my admin home if you are in some Cloud environment or maybe in localhost sometimes the IP address might be visible here but if you are using some ah Cloud environment you may see some working IB address that assistable that can go to your server if you are using a local environment UVC localhost or something like this I'm going to just copy this and then paste that here okay and then end up with the semicolon now use normally user will be if you want to find what is the user account you can go to this user accounts here you will see this root and then there are no such passwords so I can say here there are no such passwords root and then uh semicolon the database is the sample and then semicolon the next one is password I will say just a cold symbol and that's all and then finally at the semicolon okay now I will create my SQL connection the variable name for this I will say MySQL connection is equals to new MySQL connection and then parenthesis inside parenthesis I am going to pass in my connection string this one and then finally semicolon now I will add my try catch to see if there are any error or not to the catch statement I will say exception EX and finally let me go ahead and add the final keyword because we have to detect whether these X statements are being executed so this finally keyword come to play after these are executed so here we can close our connection my Square connection Dot clause parentheses semicolon now here in this try I'm going to say MySQL connection dot open and then uh I will just show some message to see the connection is success I will say connection success and then myes that is fine because we are crossing the MySQL Connection in the final keyword so here I always say some message message box dot show ex Dot message okay now we can just go to run the application connection success that means our connection is success it is connected to our database all right in the next video we are going to see how we can read data from the database to create a login application and uh don't worry I will come up with more tutorials don't forget to follow the playlist for this video and don't forget to subscribe thank you
Info
Channel: Coffee Programmer
Views: 16,458
Rating: undefined out of 5
Keywords: mysql, visual studio, mysql visual studio 2019, mysql for visual studio 2019, mysql visual studio, mysql visual studio code, c# mysql, visual studio c++ mysql, mysql for visual studio, mysql for visual studio code, write from visual studio to mysql, microsoft visual studio (software), mysql database visual studio 2019, mysql connector for visual studio 2019, mysql datasource in visual studio 2017, connection to mysql in visual studio 2022
Id: M6JJWrz2J9A
Channel Id: undefined
Length: 11min 7sec (667 seconds)
Published: Mon Dec 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.