2017-05-19 10 views
0

SQLステートメントで3番目のSelectParameterが認識されない問題[UsersDataTbl.UID] NOT IN (SELECT UID FROM [EnrollmentsTbl] WHERE ClassName = ?) AND Completed = True@ClassNameを使用しましたが、同じエラーが発生しました:「1つまたは複数の必須パラメータに値が指定されていません。SelectParameterは使用できませんか?または@

? 「実際のクラス名」では、結果は必要に応じて変わります。

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
    DataSourceID="AccessDataSource2" DataTextField="ClassName" DataValueField="ClassName"> 
</asp:DropDownList>&nbsp; 

<asp:DropDownList ID="DropDownList3" runat="server" 
    DataSourceID="AccessDataSource4" DataTextField="Battallion" 
    DataValueField="Battallion" AutoPostBack="True"> 
</asp:DropDownList>&nbsp; 

<asp:DropDownList ID="DropDownList4" runat="server" 
    DataSourceID="AccessDataSource5" DataTextField="Shift" 
    DataValueField="Shift" AutoPostBack="True"> 
</asp:DropDownList>&nbsp; 

<asp:AccessDataSource ID="AccessDataSource1" runat="server" 
DataFile="<%$ ConnectionStrings:AccessSubSiteString %>" 
    SelectCommand="SELECT [UsersDataTbl.StudentID], [UsersDataTbl.UserName], 
    [UsersDataTbl.LastName], [UsersDataTbl.FirstName], [UsersDataTbl.Affiliation], [UsersDataCareerTbl.Battallion], [UsersDataCareerTbl.Shift], [UsersDataTbl.UID], [ALSProviders.ALS] 
    FROM ([UsersDataTbl] INNER JOIN [UsersDataCareerTbl] ON (UsersDataTbl.UID = UsersDataCareerTbl.UID)) LEFT JOIN [ALSProviders] ON (UsersDataTbl.UID = ALSProviders.UID) 
    WHERE [UsersDataTbl.Career] = True AND [UsersDataTbl.Active] = True AND (UsersDataCareerTbl.Battallion = ?) AND (UsersDataCareerTbl.Shift = ?) 
    AND ([UsersDataTbl.UID] NOT IN (SELECT UID FROM [EnrollmentsTbl] WHERE ClassName = ?) AND Completed = True) 
    ORDER BY [UsersDataTbl.LastName]"> 
    <SelectParameters> 
     <asp:ControlParameter ControlID="DropDownList3" Name="Battallion" PropertyName="SelectedValue" Type="String" /> 
     <asp:ControlParameter ControlID="DropDownList4" Name="Shift" PropertyName="SelectedValue" Type="String" /> 
     <asp:ControlParameter ControlID="DropDownList1" Name="ClassName" PropertyName="SelectedValue" Type="String" />   
    </SelectParameters> 
</asp:AccessDataSource> 
+0

ID = "DropDownList1"のオブジェクトはありますか? – Hogan

+0

はい、ddlにクラス名が入力されています。 – BarclayVision

+0

デフォルトの選択値はありますか? – Hogan

答えて

0

@Rafaelの指示のおかげで、追加のJOINを追加すると修正されたようです。さらにIS NULLが必要です。ここに解像度があります:

<asp:AccessDataSource ID="AccessDataSource1" runat="server" 
DataFile="<%$ ConnectionStrings:AccessSubSiteString %>" 
    SelectCommand="SELECT [UsersDataTbl.StudentID], [UsersDataTbl.UserName], [UsersDataTbl.LastName], [UsersDataTbl.FirstName], [UsersDataTbl.Affiliation], [UsersDataCareerTbl.Battallion], [UsersDataCareerTbl.Shift], [UsersDataTbl.UID], [ALSProviders.ALS] 
    FROM (([UsersDataTbl] INNER JOIN [UsersDataCareerTbl] ON (UsersDataTbl.UID = UsersDataCareerTbl.UID)) 
    LEFT JOIN [ALSProviders] ON (UsersDataTbl.UID = ALSProviders.UID)) 
    LEFT JOIN [EnrollmentsTbl] ON (UsersDataTbl.UID = EnrollmentsTbl.UID AND ClassName = ?) 
    WHERE [UsersDataCareerTbl.Battallion] = ? 
    AND [UsersDataCareerTbl.Shift] = ? 
    AND [EnrollmentsTbl.UID] IS NULL 
    ORDER BY [UsersDataTbl.LastName]"> 
    <SelectParameters> 
     <asp:ControlParameter ControlID="DropDownList3" Name="Battallion" PropertyName="SelectedValue" Type="String" /> 
     <asp:ControlParameter ControlID="DropDownList4" Name="Shift" PropertyName="SelectedValue" Type="String" /> 
     <asp:ControlParameter ControlID="DropDownList1" Name="ClassName" PropertyName="SelectedValue" Type="String" />   
    </SelectParameters> 
</asp:AccessDataSource> 
関連する問題