2013-10-30 2 views
0

나는 그리드보기가 있습니다. 이 아래에서는 @LHNoofOverdueEMI 및 @LHDisbDate와 같은 매개 변수를 사용했습니다. @LHNoofOverdueEMI와 같거나 같은 값으로 쿼리하고 @LHDisbDate에서 특정 월의 값 값을 비교하고 싶습니다.특정 날짜까지 asp.net C#

protected void DSGVRecList_Selecting(object sender, SqlDataSourceSelectingEventArgs e) 
{ 
if (txtEMIDate.Text.Length == 0) e.Command.Parameters["@LHDisbDate"].Value = "%"; 
else e.Command.Parameters["@LHDisbDate"].Value = txtEMIDate.Text; 
if (txtNoofOverDue.Text.Length == 0) e.Command.Parameters["@LHNoofOverdueEMI"].Value = "%"; 
else e.Command.Parameters["@LHNoofOverdueEMI"].Value = txtNoofOverDue.Text; 
} 
+0

무엇이 문제입니까? – Zaki

답변

1

이 사용 시도 가지고

page.aspx

<asp:SqlDataSource ID="DSGVRecList" runat="server" 
ConnectionString="<%$ ConnectionStrings:OptimaWebCustomerQueryCon %>" 
SelectCommand="select LHID, LHAcNo, LhAcName, LHIntRate, LHDisbDate 
LHDrawingPower, LHtotalDisbAmt, LHEMI, LHNoofOverdueEMI, LHUploadDate 
from dbo.TblLoanHistory where 
(YEAR(LHUploadDate) = YEAR(GETDATE())) AND (MONTH(LHUploadDate) = MONTH(GETDATE())) 
AND LHNoofOverdueEMI ??? 
AND LHDisbDate ??? " 

onselecting="DSGVRecList_Selecting"> 
<SelectParameters> 
<asp:ControlParameter ControlID="txtNoofOverDue" Name="LHNoofOverdueEMI" PropertyName="Text" /> 
<asp:ControlParameter ControlID="txtEMIDate" Name="LHDisbDate" PropertyName="Text" /> 
</SelectParameters> 
</asp:SqlDataSource> 

C#을 : 모든 아래의 세부 사항은 SELECT DATEPART (평일,에 GetDate()를)?

지정된 날짜를 기준으로 요일을 반환합니다. 1 = 일요일 및 7 = 토요일.

+0

사실 1,4, 10, 23, 27과 같은 요일 쿼리가 필요합니다. –

관련 문제