I want to use MySQL with my Asp.Net application and would like to know how. I am going to use MySQL for the first time. The most important thing I would like to know is how
You can use the following connectionstring in your web.config to connect to mysql database:
<connectionStrings>
<add name="MySQLConnStr" connectionString="DRIVER={MySQL ODBC 3.51 Driver};Database=YourDatabase;Server=localhost;UID=YourUsername;PWD=YourPassword;"/>
</connectionStrings>
You need to do the following before attempting to connect from ASP.NET to MySQL database:
The following will perfectly explain to you the architecture of ODBC:
And for more details go through following referenced articles:
Connect to MySQL database from ASP.NET
An ASP.NET Application Using a MySQL Database (Sample Application)
ASP.NET with MySQL - Getting started
Connector/NET Examples
Hope this helps.
You have to use MySql connector API to establish the connection, execute queries and retrieving results. Take a look at tutorials.
try downloading this http://www.devart.com/dotconnect/mysql/ this is a great tool and easy to connect mysql to ASP.net but t his is trail version
and then jst drop the components on the form/page
sample code
using Devart.Data.MySql;
MySqlConnection conOne = new MySqlConnection("user id=root;password=root;host=localhost;database=studentDB");
string quePrvLT = "select rollna from studentTAble where rollna =" +res;
MySqlCommand cmdPLT = new MySqlCommand(quePrvLT, con);
int leaPLdB = (float)cmdPLT.ExecuteScalar();