As I need to make a project with Embedded MySQL and I hope to use C# as the tools. Would any one tell me how can I make the Embedded MySQl ready for connection. Especially for MySQLDirect.NET, what should I do before use this component. Thank you very much.
Alvin
Connect to Embedded MySQL
All I have tried
I've recomplied libmysqld.dll without error. Placed the library in C:\window\system32. Placed my.ini in C:\window\. But it still not work in my codes.
my.ini:
[embedded]
basedir=C:/mysql/
datadir=C:/mysqlembedded/data/
Codes:
using System;
using CoreLab.MySql;
namespace Console2003_2
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
MySqlConnection connection = new MySqlConnection("host=localhost;database=requests;user id=root;embedded=true;");
MySqlCommand command = new MySqlCommand("show databases", connection);
connection.Open();
try
{
MySqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
Console.WriteLine(reader.GetString(0));
}
}
finally
{
reader.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
connection.Close();
}
}
}
}
Return-> Additional information: 在應用程式中有錯誤。 at connection open
I use MySQL 5.0 beta and Core Lab MySQLDirect.NET latest version.
Please help.
Alvin
my.ini:
[embedded]
basedir=C:/mysql/
datadir=C:/mysqlembedded/data/
Codes:
using System;
using CoreLab.MySql;
namespace Console2003_2
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
MySqlConnection connection = new MySqlConnection("host=localhost;database=requests;user id=root;embedded=true;");
MySqlCommand command = new MySqlCommand("show databases", connection);
connection.Open();
try
{
MySqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
Console.WriteLine(reader.GetString(0));
}
}
finally
{
reader.Close();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
connection.Close();
}
}
}
}
Return-> Additional information: 在應用程式中有錯誤。 at connection open
I use MySQL 5.0 beta and Core Lab MySQLDirect.NET latest version.
Please help.
Alvin