|
|
|
รบกวนแปลงโค้ดภาษา PHP เป้นภาษา ASP ให้หน่อยค่ะ..................................... |
|
|
|
|
|
|
|
Code (PHP)
<?php
$myServer2 = "192.168.0.4";
$myUser2 = "sa";
$myPass2 = "trsc2004";
$myDB2 = "TRSC_DEV";
$dbhandle2 = mssql_connect($myServer2, $myUser2, $myPass2)
or die("Couldn’t connect to SQL Server on $myServer");
$selected2 = mssql_select_db($myDB2, $dbhandle2)
or die("Couldn’t open database $myDB2");
?>
<script language = "JavaScript">
function ListVs(SelectValue)
{
frmMain.Vsp.length = 0
frmMain.Price.value = ""
var myOption = new Option('','')
frmMain.Vsp.options[frmMain.Vsp.length]= myOption
<?php
$intRows = 0;
$sqlvps = "select visitpurpose,visitpurposespecific,visitprice from TRSC_DEV.dbo.lcVisitPurposeSpecificsPrice";
$queryvps = mssql_query($sqlvps);
while($resultvps = mssql_fetch_array($queryvps)){
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$resultvps["visitpurpose"];?>";
strValue = "<?=$resultvps["visitpurposespecific"];?>";
strItem = "<?=$resultvps["visitpurposespecific"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.Vsp.options[frmMain.Vsp.length]= myOption
}
<?
}
?>
}
function ListVsp(SelectValue)
{
frmMain.Price.value = ""
var Vs = document.getElementById('Vs') ;
var Price2 = document.getElementById('Price') ;
<?php
$intRows = 0;
$sqlvps = "select visitpurpose,visitpurposespecific,visitprice from TRSC_DEV.dbo.lcVisitPurposeSpecificsPrice";
$queryvps = mssql_query($sqlvps);
while($resultvps = mssql_fetch_array($queryvps)){
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$resultvps["visitpurposespecific"];?>";
strValue = "<?=$resultvps["visitprice"];?>";
strItem = "<?=$resultvps["visitprice"];?>";
strIvp = "<?=$resultvps["visitpurpose"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
mySubList[x,3] = strIvp;
if (mySubList[x,1] == SelectValue && mySubList[x,3]== Vs.value){
Price2.value= mySubList[x,2]
}
<?
}
?>
}
</script>
<form name="frmMain" action="" method="post">
Vs
<select id="Vs" name="Vs" onChange = "ListVs(this.value)">
<option selected value=""></option>
<?
$sql = "select distinct visitpurpose from TRSC_DEV.dbo.lcVisitPurposeSpecificsPrice";
$query = mssql_query($sql);
while($result = mssql_fetch_object($query)){
?>
<option value="<?=$result->visitpurpose;?>"><?=$result->visitpurpose;?></option>
<?
}
?>
</select>
Vsp
<select id="Vsp" name="Vsp" onChange = "ListVsp(this.value)"></select>
Price
<INPUT TYPE="text" id="Price" name="Price">
</form>
Tag : ASP, Ms SQL Server 2005, JavaScript, VBScript
|
|
|
|
|
|
Date :
2012-04-28 09:20:04 |
By :
nutzu9346 |
View :
1443 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|