Click here to Skip to main content
13,351,050 members (54,675 online)
Rate this:
Please Sign up or sign in to vote.
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
Posted 14-Feb-13 21:40pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

aspnet_regiis -i 15-Feb-13 4:15am
Good answer.. +5
Abhishek Pant 15-Feb-13 4:16am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 15 Dec 2015
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100