Click here to Skip to main content
14,739,439 members
Please Sign up or sign in to vote.
1.57/5 (3 votes)
See more:
I just want to convert PHP code into C# below is the PHP code-


$databasehost = "localhost";
$databasename = "xxxx";
$databaseusername ="xxxx";
$databasepassword = "xxxx";

$con = mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
mysql_select_db($databasename) or die(mysql_error());
$query = file_get_contents("php://input");
$sth = mysql_query($query);

if (mysql_errno()) {
    header("HTTP/1.1 500 Internal Server Error");
    echo $query.'\n';
    echo mysql_error();
    $rows = array();
    while($r = mysql_fetch_assoc($sth)) {
        $rows[] = $r;
    print json_encode($rows);

Pls rply me ASAP

bbirajdar 15-Feb-13 4:15am
Good answer.. +5
Abhishek Pant 15-Feb-13 4:16am
Download and install the PHP to ASP.NET 1.x Migration Assistant

The migration assistant download package is a 4MB self extracting zip file. We recommend that you save it to your local machine before unzipping it. After completing the download, unzip the file to a temporary directory. Follow the installation instructions in the GettingStarted_PHPtoASPNET.htm file located in the temporary directory.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900