I am experienced in the SQL query language and PHP and I am learning C#. I would like to write a program in C# to connect to a remote Mysql database. I already easily access the database using php and the following code. The php code is run on the same server as where the Mysql db resides:
<?php
require_once("config_ip.ph
p");
$dbpoint = mysql_pconnect("$dbhost", "$dbuname", "$dbpass");
$dbnpoint= mysql_select_db ("$dbname")or die(mysql_error());
$result=mysql_query("selec
t player_name,count(*),IP_ad
d,IP_ind_a
dd from xxxdata GROUP BY IP_ind_add,player_name ") or die (mysql_error());
echo "<br><table border=\"1\">";
while ($row=mysql_fetch_array($r
esult,MYSQ
L_ASSOC)) {
echo "<tr>";
while (list ($key,$value) = each($row)) {
echo "<td>". $value."</td>"; }
echo "</tr>";}
echo "</table>";
//}
?>
I would like to do essentially the same thing with a C# program or some flavor of C. I have downloaded: MySQLDriverCS and am trying to use it. But I am not sure if using MySQLDriverCS and C# is the best approach. Any ideas would be greatly appreciated.
So I am trying to sort out the proper connection string:
con = new MySQLConnection( new MySQLConnectionString("loc
alhost",
"xxxdata", //tablename
"theusername",
"thepassword").AsString );
I am pretty sure the tablename, theusername and thepassword settings are correct. But I am not sure what to put for a host name. Is it the IP address of the MySQL server I am connecting to, followed by the default port for MySQL 3306? i.e. "205.166.305.6:3306". I want to run this as a windows executable file, that will only work on an Internet connected computer.
Input on the correct connection string would be great :) I don't know if this is even possible to do in this manner with MySQLDriverCS, whether or not a remote connection is possible?
Start Free Trial