|
|
|
ผมต้องการค้นหาระหว่างวันที่ถึงวันที่อะครับ แต่เขียนแล้วไม่รันไม่ออกอะครับช่วยดูให้ที่ครับความผิดต้องไหน |
|
|
|
|
|
|
|
Code (ASP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Loyalty Program by SCGT</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/arial.js"></script>
<script type="text/javascript" src="js/cuf_run.js"></script>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/radius.js"></script>
<link href="css/ui-lightness/jquery-ui-1.10.0.custom.css" rel="stylesheet">
<script src="js/jquery.js"></script>
<script src="js/jquery-ui.custom.js"></script>
<script src="js/modernizr.js"></script>
<link rel="stylesheet" media="all" type="text/css" href="jquerydatepicker/jquery-ui.css" />
<link rel="stylesheet" media="all" type="text/css" href="jquerydatepicker/jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="jquerydatepicker/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="jquerydatepicker/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquerydatepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="jquerydatepicker/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
$(function(){
var startDateTextBox = $('#dateStart');
var endDateTextBox = $('#dateEnd');
startDateTextBox.datepicker({
dateFormat: 'dd-M-yy',
onClose: function(dateText, inst) {
if (endDateTextBox.val() != '') {
var testStartDate = startDateTextBox.datetimepicker('getDate');
var testEndDate = endDateTextBox.datetimepicker('getDate');
if (testStartDate > testEndDate)
endDateTextBox.datetimepicker('setDate', testStartDate);
}
else {
endDateTextBox.val(dateText);
}
},
onSelect: function (selectedDateTime){
endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
}
});
endDateTextBox.datepicker({
dateFormat: 'dd-M-yy',
onClose: function(dateText, inst) {
if (startDateTextBox.val() != '') {
var testStartDate = startDateTextBox.datetimepicker('getDate');
var testEndDate = endDateTextBox.datetimepicker('getDate');
if (testStartDate > testEndDate)
startDateTextBox.datetimepicker('setDate', testEndDate);
}
else {
startDateTextBox.val(dateText);
}
},
onSelect: function (selectedDateTime){
startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
}
});
});
</script>
</head>
<body>
<%
'Check if user is logged in
if Session("name") = "" then
'If not, go to login page
Response.Redirect("login.asp")
else
'If, build page
%>
<!-- START PAGE SOURCE -->
<div class="main">
<div class="header">
<div class="header_resize">
<div class="logo">
<h1><a href="index.html">Loyalty Program <img src="images/pix1.jpg" width="58" height="58" /><small>put your slogan here</small></a></h1>
</div>
<div class="clr"></div>
<div class="menu_nav">
<ul>
<li><a href="Home.asp">Home</a></li>
<li><a href="Profile.asp">Profile</a></li>
<li class="active"><a href="InputData.asp">Input dAta</a></li>
<li><a href="Report.asp">Report</a></li>
<li><a href="contact.html">Contact Us</a></li>
<li><a href="logout.asp">Logout</a></li>
</ul>
</div>
<div class="clr">
</div><table width="970" border="0" bgcolor="#FFFFFF">
<tr>
<td>
<form name="frmSearch" method="get" action="FEInvoice.asp">
<table width="950" height="129" border="0" align="center">
<tr>
<td height="33" colspan="4" align="Left"><img src="images/Find&EditInvoice.png" width="250" height="58" /></td>
</tr>
<tr>
<td width="306" height="26" align="Right">Start Date :</td>
<td width="163" align="Left"><input name="dateStart" type="text" id="dateStart" value="" size="15" maxlength="10" /></td>
<td width="75" align="Right">End Date :</td>
<td width="388" align="Left"><input name="dateEnd" type="text" id="dateEnd" value="" size="15" maxlength="10" /> </td>
</tr>
<tr>
<td height="35" colspan="4" align="center"><input type="image" src="images/submit1.gif" value="Search" /></td>
</tr>
</table></form>
<font face="MS Sans Serif" size="1"> <%
gPage= 1
gname=request.form ("dateStart")
gname1=request.form ("dateEnd")
if gname="" or gname1="" then %>
<table align="center"><tr><td><a href="FEInvoice.asp">Back to Search Page</a></td></tr></table><% else
%>
<%
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=L0820_WUTTISAA1;Database=OVCM;UID=ovcm;PWD=Ninekao9;"
Set rs =Server.CreateObject("ADODB.Recordset")
sql = "SELECT WSDLoyalty.*,WSDealer.SDealerName,WDealer.DealerName "
sql = sql & "FROM WSDLoyalty left outer join WSDealer on WSDLoyalty.SDCode=WSDealer.SDCode "
sql = sql & "left outer join WDealer on WSDLoyalty.BFDealer=WDealer.DCode "
sql = sql & "WHERE DocDate Between '"& gname &"' and '"& gname1 &"';"
rs.Open sql,conn,1, 3
TotalRow = rs.RecordCount
rs.PageSize = 20
IF TotalRow=0 THEN%>
<table align="center" border="0" width="50%" cellspacing="0">
<tr >
<td align="center" >Find Not Found</td>
<td align="center" ><%=gname%></td>
<td align="center" > Please check</td>
<br>
</tr>
</table>
<center>
<a href="FEInvoice.asp">Back to Search Page</a>
</center>
<%else
TotalPage = rs.PageCount
rs.Absolutepage =gPage
count=1
flag=1
%>
<table border="0" align="center" width="950">
<tr >
<td width="21%" align="center">Sub Dealer Name</td>
<td width="27%" align="center">Dealer Name</td>
<td width="29%" align="center">Product</td>
<td width="12%" align="center">QTY</td>
<td width="11%" align="center">Edit</td>
</tr>
<%
Do while Not rs.EOF and count <= rs.PageSize
IF flag =1 THEN
flag = 0
%>
<tr >
<form action="buyproduct.asp" method="post">
<td align="left" valign="top" ><%= rs("WSDealer.SDealerName")%></td>
<td align="left" valign="top" ><%= rs("WDealer.DealerName")%></td>
<td align="left" valign="top" ><%= rs("WSDLoyalty.Product")%></td>
<td align="right" valign="top"><%= rs("WSDLoyalty.QTY")%></td>
<td align="center" valign="top"><a href="report_SaleDetail.asp?
arcode=<%= rs("arcode")%>&gname=<%=gname%>&gname1=<%=gname1%>"><img src="images/images (1).png" width="24" height="24" /></a></td>
</form>
</tr>
<%
Else
flag = 1
%>
<tr >
<form action="buyproduct.asp" method="post">
<td align="left" valign="top" ><%= rs("WSDealer.SDealerName")%></td>
<td align="left" valign="top" ><%= rs("WDealer.DealerName")%></td>
<td align="left" valign="top" ><%= rs("WSDLoyalty.Product")%></td>
<td align="right" valign="top"><%= rs("WSDLoyalty.QTY")%></td>
<td align="center" valign="top"><a href="report_SaleDetail.asp?
arcode=<%= rs("arcode")%>&gname=<%=gname%>&gname1=<%=gname1%>"><img src="images/images (1).png" width="24" height="24" /></a></td>
</form>
</tr>
<%end if
rs.MoveNext
count = count + 1
Loop
rs.close
conn.close
end if%>
</table>
<P></P>
<TABLE border=0 cellspacing=2cellpadding=2 >
<TR>
<TD> หน้า :</TD>
<%For pg = 1 to TotalPage %>
<TD BGCOLOR="#FFCC99"> <%IF pg=cint(cstr(gPage)) Then %> <blink><B>
<%= pg%></B> </blink>
<%Else%> <B><A HREF ='Report_Sale1.asp?PageNo=<%= pg%>&gname=<%=gname%>&gname1=<%=gname1%>'><%=pg%></A></B>
<%End IF%> </TD>
<%Next
end if
%> </TR>
</Table>
</td>
</tr>
</table>
</div>
</div>
<div class="content">
<div class="content_resize">
<div class="clr"></div>
</div>
</div>
<div class="fbg">
<div class="fbg_resize">
<div class="clr">
</div>
</div>
</div>
<div class="footer">
<div class="footer_resize">
<p class="lf">Copyright © 2010 <a href="#">SiteName</a> - All Rights Reserved</p>
<p class="rf">Login</a> by <a href=""><%Response.write(Session("name"))%></a></p>
<div class="clr"></div>
</div>
</div>
</div>
<!-- END PAGE SOURCE -->
<div align=center>This template downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div>
<% end if %>
</body>
</html>
Tag : ASP, Ms SQL Server 2005, Windows
|
|
|
|
|
|
Date :
2015-06-08 16:08:59 |
By :
ninenine |
View :
1570 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง Response.write sql เอาค่าไป Query ดูบน SQL Server หน่อยครับ
|
|
|
|
|
Date :
2015-06-09 09:58:17 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|