Click here to Skip to main content
12,066,952 members (58,169 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET PHP
Hi

I just want to convert PHP code into C# asp.net 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();
}
else
{
    $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
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
aspnet_regiis -i 15-Feb-13 4:15am
   
Good answer.. +5
Abhishek Pant 15-Feb-13 4:16am
   
thanks.
Rate this: bad
 
good
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.
http://www.asp.net/downloads/archived-v11/migration-assistants/php-to-aspnet
  Permalink  
v2

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 | Mobile
Web03 | 2.8.160208.1 | Last Updated 15 Dec 2015
Copyright © CodeProject, 1999-2016
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