Hai friends,
I want to use mySql as my backend?(Iam new to that)
From my C# app how to make the connection?
regards,
Kolluru.
How can i connect my app to mysql?
8 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Hai friends,
I want to use mySql as my backend?(Iam new to that)
From my C# app how to make the connection?
regards,
Kolluru.
Know the answer? Post it. Somebody with the same question will find it here.
Sushil Badyal17 pointsPosted Apr 12, 2006, 1:46 AM EDT
Using NameSpace :
using System.Data;
using System.Data.OleDb;
Call this function:
private void connectToMySql()
{
OleDbConnection conn=new OleDbConnection("");
conn.ConnectionString="Provider=MySQLProv;Data Source=mysql;";
try
{
conn.Open();
if (conn.State==ConnectionState.Open)
MessageBox.Show("Connection to MySQL opened through OLE DB Provider");
conn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Sushil Badyal17 pointsPosted Apr 12, 2006, 1:46 AM EDT
Using NameSpace :
using System.Data;
using System.Data.OleDb;
Put this code in function:
OleDbConnection conn=new OleDbConnection("");
conn.ConnectionString="Provider=MySQLProv;Data Source=mysql;";
try
{
conn.Open();
if (conn.State==ConnectionState.Open)
MessageBox.Show("Connection to MySQL opened through OLE DB Provider");
conn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
Sushil Badyal17 pointsPosted Apr 12, 2006, 1:46 AM EDT
Using NameSpace :
using System.Data;
using System.Data.OleDb;
Put this code in function:
OleDbConnection conn=new OleDbConnection("");
conn.ConnectionString="Provider=MySQLProv;Data Source=mysql;";
try
{
conn.Open();
if (conn.State==ConnectionState.Open)
MessageBox.Show("Connection to MySQL opened through OLE DB Provider");
conn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
Marcos D. A. de Souza4 pointsPosted Apr 12, 2006, 4:47 AM EDT
Instead of use OleDB, you can access the MySQL using a Native Provider.
http://www.mysql.com/products/connector/net/
Bye
Krishna Kishore36 pointsPosted Apr 12, 2006, 11:24 PM EDT
Let me try and come back to u again.....
regards,
phiber gaius4 pointsPosted Apr 13, 2006, 5:59 PM EDT
you need to download a driver for that.
there are few connectors in the net.
you can try bytefx or something substantial.
Happy coding :)
Will Marcouiller4 pointsPosted Apr 18, 2006, 1:43 PM EDT
Greetings everyone,
I just discovered this forum which seems to be a reliable source of information about C# programming and databases implementation.
Now, I give a try wondering whether one of you knows how to install ByteFX .NET 0.76 with SharpDevelop 2.0. I firstly downloaded and installed the driver on my machine, but I can't use it...
"using ByteFX.Data.MySqlClient;"
An error displays that ByteFX can not be found... I read about somewhat an assembly or something, but I can't be sure. Might someone help me resolve this issue ?
Thank you in advance.
WILL.
Martin4 pointsPosted Apr 27, 2006, 8:49 AM EDT