 |
|
ช่วยดูโค้ดให้หน่อยค่ะต้องการบวก Request.Form("st") เพิ่มทีละ1 จนครบรอบที่กำหนดใน ต้องเพิ่มโค้ดตรงไหนค่ะ |
|
 |
|
|
 |
 |
|
จากข้อมูลแล้ว strStartDate = Request.Form("st") น่าจะเป็นตัวแปรที่เก็บค่าวันที่ใช่ไหมครับ แล้วคุณคงต้องการให้มันเพิ่มขึ้นทีละเดือน หรือ ทีละวัน หรือ ทีละปีใช่ไหมครับ ใช้ function DateAdd()
Code (ASP)
<%Dim strStartDate
Dim intMonth
Dim i
Dim Conn,strSQL,objExec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("databasestatement.mdb"),"" , ""
strStartDate = Request.Form("st")
intMonth = Request.Form("diff")
For i = 1 To intMonth
'Response.write(""&Request.Form("start")&"/"&Request.Form("st")&"/"&Request.Form("st1")&" ")& "<br>"
Response.Write(DateAdd("d",i,strStartDate)&"<br>") 'เพิ่มทีละวัน
Response.Write(DateAdd("m",i,strStartDate)&"<br>") 'เพิ่มทีละเดือน
Response.Write(DateAdd("y",i,strStartDate)&"<br>") 'เพิ่มทีละปี
Next
%>
ลองศึกษาดูจาก
https://www.thaicreate.com/vbscript/vsfctdateadd.htm
https://www.thaicreate.com/asp/asp-vbscript-dateadd.html
|
ประวัติการแก้ไข 2010-12-22 11:16:19
 |
 |
 |
 |
Date :
2010-12-22 11:15:03 |
By :
wad |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|