• The Evolution of the C# Language An interesting part of our conversation revolved...

  • A question that’s often asked is how many programming languages should I learn...

  • If you’ve worked in the world of the internet at any point in the past few years, the...

  • Pointers in C are easy and fun to learn. Some C programming tasks are performed more...

New Apps

Articles

Tips

Events

Improve Soft Skills

/ / Connect MySQL Database in ASP.NET


Here is the way to connect your MySQL Database into Asp.net Code page. First you have to download mysql.data.dll file Click here. In this page download 32 bit version MySQL connecter.exe file.

In Visual Studio right click your Project --> Add reference --> select that mysql.data.dll file.

There is one new folder created in the name of Bin in that folder there is two reference file created in the name of Mysql.data.dll and Mysql.data.dll.refresh

Now in your code window you have to include the reference in the following format.

using System.Data;

using MySql.Data.MySqlClient;


After adding reference is completed then you have to establish the database connection, like connection string.

The connection string is as follows :



MySqlConnection con = new MySqlConnection("Data Source=Servername;port=3306;Initial Catalog=databasename; User Id=ID;password=psw;");


Server Name field mentions the server IP address as 182.00.00.00 or mentions it as localhost (which  means the server is handled by you) or otherwise mentions the server IP.

Insert command coding:


MySqlCommand cmd = new MySqlCommand("insert into table_name (table_fields) values(“……..”)",con);


References :




«
Next
What Is The Future Of C#
»
Previous
Every Child Need A Teacher -- Campaign by Phoenix App Labs

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

No comments :

Leave a Reply

Thursday, April 21, 2016

Connect MySQL Database in ASP.NET


Here is the way to connect your MySQL Database into Asp.net Code page. First you have to download mysql.data.dll file Click here. In this page download 32 bit version MySQL connecter.exe file.

In Visual Studio right click your Project --> Add reference --> select that mysql.data.dll file.

There is one new folder created in the name of Bin in that folder there is two reference file created in the name of Mysql.data.dll and Mysql.data.dll.refresh

Now in your code window you have to include the reference in the following format.

using System.Data;

using MySql.Data.MySqlClient;


After adding reference is completed then you have to establish the database connection, like connection string.

The connection string is as follows :



MySqlConnection con = new MySqlConnection("Data Source=Servername;port=3306;Initial Catalog=databasename; User Id=ID;password=psw;");


Server Name field mentions the server IP address as 182.00.00.00 or mentions it as localhost (which  means the server is handled by you) or otherwise mentions the server IP.

Insert command coding:


MySqlCommand cmd = new MySqlCommand("insert into table_name (table_fields) values(“……..”)",con);


References :



No comments:

Post a Comment

Social Impact