
-
Loading...
-
szmitek
- Joined on 03-03-2007, 7:22 PM
- Chotomów, Poland
- Posts 59
|
How to delete a row in a simple auto-generated DetailsView showing content of a table? I created auto-generated DetailsView in this way:
<asp:DetailsView ID="news_table" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataSourceID="news_source" AllowPaging="True">
< Fields>
<asp:CommandField ShowEditButton="True" EditText="Edytuj" UpdateText="Aktualizuj" CancelText="Anuluj" ShowDeleteButton="True" DeleteText="Usuń nowinkę" NewText="Nowa nowinka" InsertText="Dodaj" ShowInsertButton="True" /></Fields></asp:DetailsView>
< asp:AccessDataSource ID="news_source" runat="server" DataFile="~/App_Data/data.mdb"
SelectCommand="SELECT pubDate,description_pl,description_en,title_pl,title_en,link_pl,link_en,category_pl,category_en,place,en From news"
UpdateCommand="UPDATE news Set pubDate=@pubDate,description_pl=@description_pl,description_en=@description_en,title_pl=@title_pl,title_en=@title_en,link_pl=@link_pl,link_en=@link_en,category_pl=@category_pl,category_en=@category_en,place=@place,en=@en" DeleteCommand="DELETE FROM news WHERE description_pl = @description_pl" InsertCommand="INSERT Into news (pubDate,description_pl,description_en,title_pl,title_en,link_pl,link_en,category_pl,category_en,place,en) Values (@pubDate,@description_pl,@description_en,@title_pl,@title_en,@link_pl,@link_en,@category_pl,@category_en,@place,@en)"><DeleteParameters><asp:FormParameter FormField="news_table$ctl02" Name="description_pl"/></DeleteParameters></asp:AccessDataSource>
After clicking "Usuń nowinkę" (deleting button), the error occurs "System.Data.OleDb.OleDbException: No value given for one or more required parameters". Earlier I tried without parameter, with ControlParameter, with Parameter (Name="description_pl") and this causes the same error. Data is inserted, updated and selected correctly, only deleting causes error. When I used simple DeleteCommand "Delete From news", whole content of the table was being deleted. Could you help me? I am asking for help politely.
|
|