In this article I will show you how to add a MySQL database with your .NET application in C#.
For this you need to add MySql.Data.dll as a reference in your project. You can download the dll from here. After downloading the dll select your project and right click on the project, click on the add reference menu. Then browse the dll to add it.
After adding add a new namespace in your .cs page.
Now after this create a new string which will act as your connection string.
Generally use port no 3306 as port no in your connection string.
Now to create a new connection
Code:
Now for command write the follow code
Now to get the value into a datatable add these.
If you want to perform any insert, update, delete query then these are the code to proceed.
So add the MySQL database and enjoy...
0 comments:
Post a Comment