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

PHP
<?

$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
Updated 7-Apr-22 19:59pm

 
Share this answer
 
Comments
bbirajdar 15-Feb-13 4:15am    
Good answer.. +5
Abhishek Pant 15-Feb-13 4:16am    
thanks.
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
 
Share this answer
 
v2
Comments
Moaz Moaz 10-Apr-22 5:11am    
al = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
  x = Text1.Text
  key = Text2.Text
  Text2.Text = " "
  Call streamkey(key)
    For i = 1 To Len(x)
   m = UCase(Mid(x, i, 1))
   n = UCase(Mid(key, i, 1))
   For j = 0 To 25
   If (m = al(j)) Then
      f = j
 End If
     Next j
 For k = 0 To 25
   If (n = al(k)) Then
      g = k
 End If
     Next k
      a = (f + g) Mod 26
      t = t & al(a)
      Next i
      Text2.Text = key
      Text3.Text = t
End Sub
Private Sub streamkey(key)
 For i = 1 To Abs(Len(Text1.Text) - Len(key))
 c = Mid(key, i, 1)
 If (Len(key) <= Len(Text1.Text)) Then
 key = key & c
 End If
 Next i
 If (Len(key) > Len(Text1.Text)) Then
  key = Mid(key, i, Len(Text1.Text))
  End If 

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