I wrote an application using c# and mySQL database. But when I deploy it
doesn't work on an other PC. How can I embed mysql in C#.
I think you have a fundamental misunderstanding of what mySql is or rather,
much more importantly, what it is not.
Like SQL Server and Oracle, etc, it is a server-based RDBMS. It is not the
same as, say, an Access database in this respect. You can't "embed" it in C#
as such.
You need to install mySql on a server which is "visible" to your client(s) -
this could be on a server local to their network, or on the Internet. If
this is a WinForms app, the client machine(s) will need at least the .Net
Framework installed and a reasonably recent version of MDAC. If this is a
WebForms app, your webserver will similarly need a resonably recent version
of MDAC - your sebserver will already have the .NET Framework installed as
part of the IIS installation.
Luckily, once this is in place, interfacing with mySql in the .NET world is
relatively simple - all you require is a .NET data provider. There are
several native .NET data providers available, as well as OleDb providers and
even ODBC drivers.
You will also need some mechanism of telling the client(s) how to connect to
the mySql database - this is achieved by means of a connection string.
So...
1) Where is the mySql server?
2) Is this a WinForms or WebForms app?
3) What .NET data provider are you using?