how to set sqldatasource deafult value as database field value. i have a coding like,
<asp:DropDownList ID="ddVehicle" runat="server" AppendDataBoundItems="true" CssClass="drop" DataSourceID="SqlDataSource4" DataTextField="VehicleType" DataValueField="VehicleId">
<asp:ListItem Value="">-Select-</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:TAXIConnectionString %>" SelectCommand="SELECT [VehicleId], [VehicleType] FROM [VehicleMaster] WHERE ([VehicleId] = @Vehicle or [Status] = @Status1)">
<SelectParameters>
<asp:Parameter DefaultValue="???" Name="Vehicle" Type="String" />
<asp:Parameter DefaultValue="Available" Name="Status1" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
help me.
尝试这个:
SqlDataSource4.SelectParameters.Add("@Vehicle", "Vehicle Value");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.