顯示具有 asp 標籤的文章。 顯示所有文章
顯示具有 asp 標籤的文章。 顯示所有文章

2014年4月21日 星期一

asp-excel (numeric to string, formula)

<TD>="0001"</TD>
      <TD>The Perfect Programming Book</TD>
      <TD>13.00</TD>
      <TD>5.00</TD>
      <TD>8.25%</TD>
      <TD>=Sum(c2:d2)*(1+E2)</TD>

2014年3月31日 星期一

asp-json

http://www.aspjson.com/

?([['1032298','11743566'],['1033260','101-3774906'],['1033261','850 203 605 SOH'],['1033262','101-3774907'],['1033263','850 203 616 SOH']])


'?([
'['1396235501819','Government Logistics Department','REF','A'],
'['1396235623593','Government Logistics Department','2','D'],
'['1396235673056','Government Logistics Department','ASDFAASDFAFD','D']
']);



$.getJSON(s,
function(data) {
if (data[0]){
lastOffset=offset;
}
}
)






http://stackoverflow.com/questions/5943630/basic-example-of-using-ajax-with-jsonp


2014年3月27日 星期四

asp-excel-numeric to string format

for each field_ in afields if r0=17 then f.write("<style> TD { mso-number-format:\@; } </style>") end if f.write("<td>") f.write(field_) f.write("</td>") if r0=17 then f.write("<style> TD { mso-number-format:General; } </style>") end if r0=r0+1 next

f.write(field_)
'f.write(":"&r0)
f.write("</td>")
r0=r0+1
next

2014年3月26日 星期三

asp-excel javascript-excel

1. individual Name
2. fileName P_fileName
3. p_mode
4. Test the list
5 Edit the Button
6. Edit the call Program.

Example : salesBydotCom

Step 1
p_mode=trim(Request.querystring("p_mode")) 'for excel
p_fileName=trim(Request.querystring("p_fileName")) 'for excel

Step 2
fileName=Int((max-min+1)*Rnd+min)
if p_fileName<>"" then  'for excel
fileName=p_fileName 'for excel
end if 'for excel

Step 3
'for Excel
if p_mode="E" then
ReportName=ReportName+"_"+pcus+"_"
end if

Step 5
for each x in acustomerNOs
html=x
o=x
x=Replace(x, ",", "_")
x=Replace(x, " ", "_")
x=Replace(x, "'", "_")
o=Replace(o, "'", "_")
o=Replace(o, " ", "__")
response.write("<button class='customerButton' style='display:none; float:left;' onclick=custDisplay3('"&x&"','"&o&"');>"&html&"</button>")
next

Step 6
// for excel
function custDisplay3(pcustcode,sql_custcode){
$('.allcustcode').css('display','none');
$('.class_'+pcustcode).css('display','block');
sql_custcode=sql_custcode.replace(/__/g," ");
i=sql_custcode.indexOf("_");
if (i>1) sql_custcode=sql_custcode.substring(0,i);
url_='salesByDotComsList10.asp?cus='+sql_custcode+'&p_fileName=<%=fileName%>&p_mode=E&callback=?';
$.getJSON(url_,
function(data) {
if (data[0]){
for (r=0 ; r<data.length; r++)
{
//alert(data[0][0]);
//obj_field.options[r+1] = new Option(data[r][0],data[r][1]);
}
}
}
)
}



function callExcel Program(pcustcode){
$('.allcustcode').css('display','none');
$('.class_'+pcustcode).css('display','block');
sql_custcode=pcustcode
sql_custcode=sql_custcode.replace(/__/g," ");
i=sql_custcode.indexOf("_");
if (i>1) sql_custcode=sql_custcode.substring(0,i);
url_='forecastVSActualCustomerFtyList9.asp?cus='+sql_custcode+'&p_fileName=<%=fileName%>&p_mode=E&callback=?';
$.getJSON(url_,
function(data) {
}

}

2014年3月25日 星期二

asp-excel




/////////////////////////////////////////////////////  call and back /call.and.back////////////////////
<%
if  p_mode="E" then
response.write("parent.closeWindow();")
end if
%>
function newWindow(url) {
 popupWindow = window.open(
  url,
  'popUpWindow','height=500,width=650,left=10,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}

function closeWindow()
{
   if(false == popupWindow.closed)
   {
      popupWindow.close ();
   }
   else
   {
      alert('That window is already closed. Open the window first and try again!');
   }
}

//////////////////////////////////////////////// end of call and back //////////////////////////////////////////






function custDisplay3(pcustcode,sql_custcode){
$('.allcustcode').css('display','none');
$('.class_'+pcustcode).css('display','block');
sql_custcode=sql_custcode.replace(/__/g," ");

i=sql_custcode.indexOf("_");
if (i>1) sql_custcode=sql_custcode.substring(0,i);
<%
IF mode="C" THEN
response.write("url_='salesByMajorAndOtherList15.asp?prog='+sql_custcode+'&p_fileName="&fileName&"&p_mode=E';")
else
response.write("url_='salesByMajorAndOtherList15.asp?buyg='+sql_custcode+'&p_fileName="&fileName&"&p_mode=E';")
end if

%>

//url_='salesByMajorAndOtherList15.asp?buyg='+sql_custcode+'&p_fileName=<%=fileName%>&p_mode=E';

newWindow(url_);
}

2014年3月15日 星期六

asp-code-value update ajax

if 1=0 then
response.write("<span>Customer : </span>")
'response.write("<span>"&Pcus &"</span>")
SQLStmt.CommandText="select name from customer where no_ ='" &pcus&"'"
SQLStmt.CommandType = 1
RS.Open SQLStmt
if  Not RS.EOF   then
CUSNAM=rs("name")
response.write(CUSNAM)
end if
rs.close
end if

2014年2月27日 星期四

asp-session

session("a")=nothing
session("a")="newValue"

asp-select asp-case


dim str1
select case day(date)
case 1,2,3,4,5,6,7,8,9,10
str1="month first"
case 11,12,13,14,15,16,17,18,19,20
str1="month middle"
case else
str1="month tail"
End Select

2014年2月23日 星期日

asp-default-date datefrom dateto asp monthone monthend mthend mthone

dim thisYear
thisYear=year(now) 
months=year(now)*12+month(now)-1
defaultyear=int(months/12)
defaultmonth=months mod 12
defaultdayfrom=1
if defaultmonth=1 or defaultmonth=3  or defaultmonth=5  or defaultmonth=7  or defaultmonth=8  or defaultmonth=10  or defaultmonth=12 then
defaultdayto=31
elseif defaultmonth=4 or defaultmonth=6  or defaultmonth=9  or defaultmonth=11 then
defaultdayto=30
else
if 0 = defaultYear Mod 4 then
defaultdayto=28
else 
defaultdayto=29
end if 
end if 

2014年2月3日 星期一

2013年12月17日 星期二

asp date to string

asp date2string

CurrentDate = Date()
CurrentTime = Now()
NewDate = DatePart("yyyy", CurrentDate)
NewDate1 = DatePart("m", CurrentDate)
NewDate2 = DatePart("d", CurrentDate)
hh = DatePart("h", CurrentTime)
mm = DatePart("m", CurrentTime)
ss = DatePart("s", CurrentTime)
hh=hh+1
outFile=NewDate&"-"&NewDate1&"-"&NewDate2&"_"&hh&"_"&mm&"_"&ss

2013年12月16日 星期一

asp-random

<script type="text/vbscript">

Dim max,min
max=100
min=1
Randomize
document.write(Int((max-min+1)*Rnd+min))

</script>

asp-excel

inf : http://stackoverflow.com/questions/440892/how-to-output-an-excel-xls-file-from-classic-asp

<%@ Language=VBScript %>
<%  Option Explicit
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=excelTest.xls"
%>
<table>
    <tr>
        <td>Test</td>
        <td>Test</td>
    </tr>
<tr>

</tr>
<tr>
</tr>

test test
<tr>
</tr>
<tr>
</tr>

</table>

<table>
    <tr>
        <td>Test</td>
    </tr>
</table>

2013年12月13日 星期五

asp-type


asp-data-type asp-variable-type

dim i,s,a
i = 1
s = "Hello world"
a = split("Hello World"," ")

WScript.Echo TypeName(i) 'Displays "Integer"
WScript.Echo TypeName(s) 'Displays "String"
WScript.Echo TypeName(a) 'Displays "Variant()

2013年11月3日 星期日

asp-left asp-right

<!DOCTYPE html>
<html>
<body>

<%
sometext="Welcome to this Web"
response.write(Left(sometext,5))
response.write("<br>")
response.write(Right(sometext,5))
%>


</body>
</html>

2013年11月2日 星期六

asp-translate numeric format

asp-roundup
asp-mask
asp-numeric mask

0 -> 0.00000


MthOnHand=RS("MthOnHand")
MthOnHand=FormatNumber(MthOnHand,5)


surplus=RS("surplus")
unitCost=RS("unitCost")
unitCost=FormatNumber(unitCost,5)  



2013年11月1日 星期五

asp-trim



<script type="text/vbscript">

fname=" trimtest "


</script>

asp-in inlist foxpro$

asp-string-in-string



<!DOCTYPE html>
<html>
<body>

<script type="text/vbscript">

txt="This is a beautiful day!"
document.write(InStr(txt,"beautiful"))

</script>

</body>
</html>

asp-combo html-combo




<label>WareHouse
<select  id="loc" name="loc">
<%Call createList(bookTypes)
%>
</select>
</label>


<%
Dim bookTypes(10) 
bookTypes(0)="choice0"
bookTypes(1)="choice1"
bookTypes(2)="choice2"
bookTypes(3)="choice3"
bookTypes(4)="choice3" 
bookTypes(5)="choice4"
bookTypes(6)="choice5"
bookTypes(7)="choice6" 
bookTypes(8)="choice7" 
bookTypes(9)="choice8" 
Sub createList(some_array) 
dim i
response.write("<option value=" & i & ">" & i & "</option>" & vbCrLf)
For Each i in some_array
if i<>"" then
response.write("<option value=" & i & ">" & i & "</option>" & vbCrLf)
end if
Next 
End Sub  
%>  

2013年10月31日 星期四

asp-next-line



asp for each in array

inf http://webcheatsheet.com/asp/loops.php

<%
Dim bookTypes(7) 'creates first array
bookTypes(0)="Classic"
bookTypes(1)="Information Books"
bookTypes(2)="Fantasy"
bookTypes(3)="Mystery"
bookTypes(4)="Poetry"
bookTypes(5)="Humor"
bookTypes(6)="Biography"
bookTypes(7)="Fiction"

Dim arrCars(4) 'creates second array
arrCars(0)="BMW"
arrCars(1)="Mercedes"
arrCars(2)="Audi"
arrCars(3)="Bentley"
arrCars(4)="Mini"

Sub createList(some_array) 'takes an array and creates drop-down list
  dim i
  response.write("<select name=""mylist"">" & vbCrLf) 'vbCrLf stands for Carriage Return and Line Feed
  For Each item in some_array
     response.write("<option value=" & i & ">" & item & "</option>" & vbCrLf)
     i = i + 1
  Next 'repeat the code and move on to the next value of i
  response.write("</select>")
End Sub

'Now let's call the sub and print out our lists on the screen
Call createList(bookTypes) 'takes bookTypes array as an argument
Call createList(arrcars) 'takes arrCars array as an argument
%>