First you have to install this:
http://dev.mysql.com/downloads/connector/net/[
^]
And here a sample doing the same as your PHP does...
using MySql.Data.MySqlClient;
MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = "server=localhost;uid=root;pwd=password;database=database;";
try
{
conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
}
string sql = string.Format("INSERT INTO user (username, password, joindate, active) VALUES ({0}, {1}, {2}, {3})", username, password, joindate, active);
MySqlCommand cmd = new MySqlCommand(sql, conn);
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
}
conn.Close();