我有这个gridview,我使用sqldatasource
这是我的选择命令,
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TAXIConnectionString %>"
SelectCommand="SELECT [TripId] FROM [BookingMaster]
WHERE(([PickupLocation] = @PickupLocation or @PickupLocation is null)
AND ([DestinationLocation] = @DestinationLocation
or @DestinationLocation is null )
AND ([Status] = @Status or @Status is null)
AND (cast([PickupDateTime] as date) = @PickupDateTime
or @PickupDateTime is null))"
CancelSelectOnNullParameter="False">
<SelectParameters>
<asp:ControlParameter ControlID="ddPickup" Name="PickupLocation"
PropertyName="SelectedValue" Type="String"
ConvertEmptyStringToNull="true" />
<asp:ControlParameter ControlID="ddDestination" Name="DestinationLocation"
PropertyName="SelectedValue" Type="String"
ConvertEmptyStringToNull="true" />
<asp:ControlParameter ControlID="ddStatus" Name="Status"
PropertyName="SelectedValue" Type="String"
ConvertEmptyStringToNull="true" />
<asp:ControlParameter ControlID="txtBookingDate" Name="PickupDateTime"
PropertyName="Text" Type="String" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:SqlDataSource>
但是当我选择 13 之后的日期时出现错误,否则......
Server Error in '/' Application.
Conversion failed when converting date and/or time from character string.
这有什么问题?