C# LinqDataSource,其中包含数据库中的dropdownlist和字段的参数
我将执行一个LINQListView where子句,其中where子句有两个项目:第一个来自Dropdownlist选择(这项工作很好)。我想从我的数据库(isAvailable)的a表字段中添加另一个选择。您能解释一下如何使用表字段isaviable(bool类型)填充where子句的请求吗。我用C#做这件事。代码如下:C# LinqDataSource,其中包含数据库中的dropdownlist和字段的参数,c#,sql,linq,C#,Sql,Linq,我将执行一个LINQListView where子句,其中where子句有两个项目:第一个来自Dropdownlist选择(这项工作很好)。我想从我的数据库(isAvailable)的a表字段中添加另一个选择。您能解释一下如何使用表字段isaviable(bool类型)填充where子句的请求吗。我用C#做这件事。代码如下: <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="Apointmen
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="ApointmentDataContext"
EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName=""
TableName="RendezVous" AutoGenerateWhereClause="True">
<WhereParameters>
<asp:ControlParameter
Name="DoctorName"
ControlID="DropDownList1"
PropertyName="SelectedValue"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>
<div class="center">
<asp:Label ID="lblDoctor" runat="server" Text="Choose a name"> </asp:Label>
<div class="value-right">
<asp:DropDownList ID="DropDownList1" runat="server" Width="180px" AutoPostBack="true" >
<asp:ListItem Text="Doct A" Value="Doc A" />
<asp:ListItem Text="Doct B" Value="Doc B" />
<asp:ListItem Text="Doct C" Value="Doc C" />
</asp:DropDownList>
</div>
</div>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="itemPlaceholderContainer" runat="server" border="0" style="">
<tr runat="server" style="">
<th runat="server"></th>
<th runat="server">DoctName</th>
<th runat="server">date</th>
<th runat="server">hour</th>
<th runat="server">patientName</th>
<th runat="server">isAvailable</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="">
<td>
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete"
Text="Delete" />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
</td>
<td>
<asp:Label ID="lblDoctorName" runat="server" Text='<%#
Eval("DoctorName") %>' />
</td>
<td>
<asp:Label ID="lblDate" runat="server" Text='<%# Eval("date") %>' />
</td>
<td>
<asp:Label ID="lblhour" runat="server" Text='<%# Eval("hour") %>' />
</td>
<td>
<asp:Label ID="lblPatient" runat="server" Text='<%# Eval("patientName") %>'
/>
</td>
<td>
<asp:Label ID="isAvailable" runat="server" Text='<%# Eval("isAvailable") %>'
/>
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
医生姓名
日期
小时
病人姓名
可用
我需要把字段isAvailable放在where子句的内部,这样我就可以找到它了。谢谢您是指生成apointent.designer.cs的apointem.dbml中的App_代码吗?我想从中添加更多条件,但这些条件将基于表中的字段(可用)。该字段将不会来自dropdownlist。可以这样做吗?是的,该字段将是来自apointent.dbml的App_代码的一个表,它生成apointent.designer.cs