0

I have a grid view. Under this, I have used some parameter like @LHNoofOverdueEMI and @LHDisbDate. I want to query by grater than or equal value of @LHNoofOverdueEMI and equal to value of specific day value of any month or year from @LHDisbDate. All are details below:

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#

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;
}
1
  • and what is the problem? Commented Oct 30, 2013 at 12:32

1 Answer 1

1

Have you tried using: SELECT DATEPART(weekday,GetDate()) ?

It returns the day of the week based on the specified date. 1 = Sunday and 7 = Saturday.

Sign up to request clarification or add additional context in comments.

1 Comment

Actually I want any day query like 1,4 , 10, 23, 27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.