我有一个DetailsView和SqlDataSource
,带有选择/更新/删除命令。
这是我的代码:
<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateRows="False" HeaderText="Rechnung Details" DataKeyNames="InvoiceID" CssClass="table table-striped table-bordered" EmptyDataText="Rechnung ist nicht vorhanden!">
<Fields>
....
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RechnungConnectionString %>"
SelectCommand="SELECT Invoice.[InvoiceID], Invoice.[InvoiceManual], Invoice.[CustomerID], Invoice.[Date], Invoice.[Amount], Invoice.[Total], Invoice.[Paid], Invoice.[Rest], Invoice.[PaymentType], Invoice.[Shipped], Customer.[CustomerID], Customer.[Name], Customer.[Tell], Customer.[Address], Customer.[Comment] FROM [Invoice] INNER JOIN [Customer] ON Invoice.[CustomerID] = Customer.[CustomerID] WHERE Invoice.[InvoiceID] = @InvoiceID AND [Invoice].IsDeleted != 1"
UpdateCommand="UPDATE [Invoice] SET Invoice.[InvoiceManual]=@InvoiceManual, Invoice.[Date]=<%# CONVERT(Date,@Date,103) %>, Invoice.[Amount]=@Amount, Invoice.[Paid]=@Paid, Invoice.[PaymentType]=@PaymentType, Invoice.[Shipped]=@Shipped WHERE [InvoiceID]=@InvoiceID"
DeleteCommand="UPDATE [Invoice] SET Invoice.[IsDeleted] = 1 WHERE [InvoiceID]=@InvoiceID">
<SelectParameters>
<asp:QueryStringParameter Name="InvoiceID" QueryStringField="ID" />
</SelectParameters>
</asp:SqlDataSource>
这是我的表想要从detailsview更新:
1001 14-1001 1000 2014-12-15 250.00 297.50 100.00 197.50 Bar 1 0 0
1002 14-1002 1001 2014-10-10 250.00 297.50 0.00 297.50 Bar 1 0 0
1006 14-1003 1001 2014-05-10 500.00 595.00 200.00 395.00 Bar 1 0 0
1007 13-1004 1001 2013-12-10 450.00 535.50 100.00 435.50 Überweisung 1 0 0
但是详细信息视图中的问题日期列是{dd.mm.yyyy}
(德语),数据库的日期列是{yyyy-mm-dd}
我需要一些转换或其他内容,我在UpdateCommand中尝试Invoice.[Date]=<%# CONVERT(Date,@Date,103) %>
但是不行。