Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP PHP
Hi,
 
Would anyone be so kind to convert my php into asp please?
 
Greatly appreciated.
James
 
<?
$objConnect = mysql_connect("***","***","***") or die(mysql_error());
$objDB = mysql_select_db("***");
 
//*** Add ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO xxxxxxx ";
$strSQL .="(ID,StartDateTime,EndDateTime,Name,Email,Telephone,SMS,Sex) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtAddID"]."','".$_POST["txtAddStart"]."','".$_POST["txtAddEnd"]."','".$_POST["txtAddName"]."' ";
$strSQL .=",'".$_POST["txtAddEmail"]."' ";
$strSQL .=",'".$_POST["txtAddTelephone"]."','".$_POST["txtAddSMS"]."' ";
$strSQL .=",'".$_POST["txtAddSex"]."') ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Save [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
 
//*** Update ***//
if($_POST["hdnCmd"] == "Update")
{
$strSQL = "UPDATE xxxxxxx SET ";
$strSQL .="ID = '".$_POST["txtEditID"]."' ";
$strSQL .=",StartDateTime = '".$_POST["txtEditStart"]."' ";
$strSQL .=",EndDateTime = '".$_POST["txtEditEnd"]."' ";
$strSQL .=",Name = '".$_POST["txtEditName"]."' ";
$strSQL .=",Email = '".$_POST["txtEditEmail"]."' ";
$strSQL .=",Telephone = '".$_POST["txtEditTelephone"]."' ";
$strSQL .=",SMS = '".$_POST["txtEditSMS"]."' ";
$strSQL .=",Sex = '".$_POST["txtEditSex"]."' ";
$strSQL .="WHERE ID = '".$_POST["hdnEditID"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
 
//*** Delete ***//
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM xxxxxxx ";
$strSQL .="WHERE ID = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
 
$strSQL = "SELECT * FROM xxxxxxx order by ID";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form name="frmMain" method="post" action="<?=$_SERVER["PHP_SELF"];?>">
<!-- Headings -->
<input type="hidden" name="hdnCmd" value="">
<table>
<tr>
<th>ID<br><sub>Max of 6 Characters</sub></th>
<th>Start Date & Time<br><sub>yyyy-mm-dd hh:mm:ss</sub></th>
<th>End Date & Time<br><sub>yyyy-mm-dd hh:mm:ss</sub></th>
<th>Name<br><sub>Full Name</sub></th>
<th>Email<br><sub>All lower case<br>In the format of xxx@xxx.xxx</sub></th>
<th>Telephone<br><sub>No Spaces<br>(11 digits including area code)</sub></th>
<th>SMS<br><sub>No Spaces<br>(11 digits only)</sub></th>
<th>Him or Her<br><sub>Him or Her Only</sub></th>
<th colspan="2">Select Option<br><sub>Add, Edit or Delete</sub></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
 
<?
if($objResult["ID"] == $_GET["CusID"] and $_GET["Action"] == "Edit")
{
?>
<!-- In Edit Mode -->
<tr>
<td>
<input type="text" name="txtEditID" value="<?=$objResult["ID"];?>">
<input type="hidden" name="hdnEditID" value="<?=$objResult["ID"];?>">
</td>
<td><input type="text" name="txtEditStart" value="<?=$objResult["StartDateTime"];?>"></td>
<td><input type="text" name="txtEditEnd" value="<?=$objResult["EndDateTime"];?>"></td>
<td><input type="text" name="txtEditName" value="<?=$objResult["Name"];?>"></td>
<td><input type="text" name="txtEditEmail" value="<?=$objResult["Email"];?>"></td>
<td><input type="text" name="txtEditTelephone" value="<?=$objResult["Telephone"];?>"></td>
<td><input type="text" name="txtEditSMS" value="<?=$objResult["SMS"];?>"></td>
<td><input type="text" name="txtEditSex" value="<?=$objResult["Sex"];?>"></td>
<td colspan="2" align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</td>
</tr>
<?
}
else
{
?>
<!-- In View Mode -->
<tr>
<td><?=$objResult["ID"];?></td>
<td><?=$objResult["StartDateTime"];?></td>
<td><?=$objResult["EndDateTime"];?></td>
<td><?=$objResult["Name"];?></td>
<td><?=$objResult["Email"];?></td>
<td><?=$objResult["Telephone"];?></td>
<td><?=$objResult["SMS"];?></td>
<td><?=$objResult["Sex"];?></td>
<td><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&CusID=<?=$objResult["ID"];?>">Edit</a></td>
<td><a href="java<!-- no -->script:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&CusID=<?=$objResult["ID"];?>';}">Delete</a></td>
</tr>
<?
}
?>
<?
}
?>
<!-- In Add Mode -->
<tr>
<td><input type="text" name="txtAddID"></td>
<td><input type="text" name="txtAddStart"></td>
<td><input type="text" name="txtAddEnd"></td>
<td><input type="text" name="txtAddName"></td>
<td><input type="text" name="txtAddEmail"></td>
<td><input type="text" name="txtAddTelephone"></td>
<td><input type="text" name="txtAddSMS"></td>
<td><input type="text" name="txtAddSex"></td>
<td colspan="2" align="center">
<input name="btnAdd" type="button" id="btnAdd" value="Add" OnClick="frmMain.hdnCmd.value='Add';frmMain.submit();">
</td>
</tr>
</table>
</form>
<?
mysql_close($objConnect);
?>
Posted 25-Jan-13 1:24am
J3ffers210
Edited 25-Jan-13 1:26am
v2
Comments
aspnet_regiis -i at 25-Jan-13 6:29am
   
You have posted it at the wrong place. You need to post it here ^
Milind_T at 25-Jan-13 6:42am
   
Well J3ffers, you need to outsource to someone. At CP, you ask for help in case you are stuck somewhere.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Convert PHP to ASP[^] online convert from here
  Permalink  
Comments
J3ffers at 25-Jan-13 6:35am
   
Thanks Abhishek, I've tried that and it spits out a few errors.
Abhishek Pant at 25-Jan-13 6:53am
   
Insert the id labels directly on that code.I think that will resolve your error.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Paid someone.. not really was just trying my luck as I have little to no experience in asp.. cheers anyway guys..
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 545
1 OriginalGriff 285
2 Shweta N Mishra 244
3 Mathew Soji 225
4 BillWoodruff 200
0 OriginalGriff 6,153
1 Sergey Alexandrovich Kryukov 5,758
2 DamithSL 4,958
3 Manas Bhardwaj 4,539
4 Maciej Los 3,735


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 9 Jul 2013
Copyright © CodeProject, 1999-2014
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