0
我有一個網格視圖。在此之下,我使用了一些參數,如 @LHNoofOverdueEMI和@LHDisbDate。我想通過@LHNoofOverdueEMI的等於或等於 等於任意月份或年份的價值 來查詢@LHDisbDate的值。所有的詳情如下:由特定天asp.net c查詢#
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;
}
這是什麼問題? – Zaki