Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   cannot delete or edit inserted records ( via detailsview) in gridview (http://www.velocityreviews.com/forums/t361549-cannot-delete-or-edit-inserted-records-via-detailsview-in-gridview.html)

Marc 07-31-2006 05:48 PM

cannot delete or edit inserted records ( via detailsview) in gridview
 
Hi,

I made a detailsview for inserting records.
I also made a gridview for editing and deleting the same records.
The keyfield is an autonumbering field in Access (pcnr).

My problem is: I can see the new inserted records in the gridview but I
can't delete or edit them. When clicking on delete or edit link, nothing
happens (no error either). All the others records (not inserted via the
detailsview) can be edited and deleted.

Thanks for help
Marc

Here part of my code with the gridview:
---------------------------------------
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=C:\mydb"
DeleteCommand="DELETE FROM [pc] WHERE [pcnr] = ? AND [naam] = ? AND
[defect] = ? AND [type] = ? AND [software] = ? AND [lokaal] = ?"
InsertCommand="INSERT INTO [pc] ([pcnr], [naam], [defect], [type],
[software], [lokaal]) VALUES (?, ?, ?, ?, ?, ?)"
OldValuesParameterFormatString="original_{0}"
ProviderName="System.Data.OleDb"
SelectCommand="SELECT * FROM [pc]" UpdateCommand="UPDATE [pc] SET [naam]
= ?, [defect] = ?, [type] = ?, [software] = ?, [lokaal] = ? WHERE [pcnr] = ?
AND [naam] = ? AND [defect] = ? AND [type] = ? AND [software] = ? AND
[lokaal] = ?">
<DeleteParameters>
<asp:Parameter Name="original_pcnr" Type="Int32" />
<asp:Parameter Name="original_naam" Type="String" />
<asp:Parameter Name="original_defect" Type="Boolean" />
<asp:Parameter Name="original_type" Type="String" />
<asp:Parameter Name="original_software" Type="String" />
<asp:Parameter Name="original_lokaal" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="naam" Type="String" />
<asp:Parameter Name="defect" Type="Boolean" />
<asp:Parameter Name="type" Type="String" />
<asp:Parameter Name="software" Type="String" />
<asp:Parameter Name="lokaal" Type="String" />
<asp:Parameter Name="original_pcnr" Type="Int32" />
<asp:Parameter Name="original_naam" Type="String" />
<asp:Parameter Name="original_defect" Type="Boolean" />
<asp:Parameter Name="original_type" Type="String" />
<asp:Parameter Name="original_software" Type="String" />
<asp:Parameter Name="original_lokaal" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" PageSize="14" width="990px"
AutoGenerateColumns="False" CellPadding="4" DataKeyNames="pcnr"
DataSourceID="SqlDataSource1"
ForeColor="#333333" GridLines="None">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lb1" runat="server"
OnClientClick="return confirm(yes?');"
CommandName="Delete">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="pcnr" HeaderText="pcnr"
InsertVisible="False" ReadOnly="True"
SortExpression="pcnr" />
<asp:BoundField DataField="naam" HeaderText="naam"
SortExpression="naam" />
<asp:CheckBoxField DataField="defect" HeaderText="defect"
SortExpression="defect" />
<asp:BoundField DataField="type" HeaderText="type"
SortExpression="type" />
<asp:BoundField DataField="software" HeaderText="software"
SortExpression="software" />
<asp:BoundField DataField="lokaal" HeaderText="lokaal"
SortExpression="lokaal" />
</Columns>
</asp:GridView>





Marc 07-31-2006 06:05 PM

Re: cannot delete or edit inserted records ( via detailsview) in gridview
 
I found it.
All the fields must be filled ..


"Marc" <mmm@ze.az> schreef in bericht
news:%23RBPKmMtGHA.1536@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I made a detailsview for inserting records.
> I also made a gridview for editing and deleting the same records.
> The keyfield is an autonumbering field in Access (pcnr).
>
> My problem is: I can see the new inserted records in the gridview but I
> can't delete or edit them. When clicking on delete or edit link, nothing
> happens (no error either). All the others records (not inserted via the
> detailsview) can be edited and deleted.
>
> Thanks for help
> Marc
>
> Here part of my code with the gridview:
> ---------------------------------------
> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
> ConflictDetection="CompareAllValues"
> ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data
> Source=C:\mydb"
> DeleteCommand="DELETE FROM [pc] WHERE [pcnr] = ? AND [naam] = ? AND
> [defect] = ? AND [type] = ? AND [software] = ? AND [lokaal] = ?"
> InsertCommand="INSERT INTO [pc] ([pcnr], [naam], [defect], [type],
> [software], [lokaal]) VALUES (?, ?, ?, ?, ?, ?)"
> OldValuesParameterFormatString="original_{0}"
> ProviderName="System.Data.OleDb"
> SelectCommand="SELECT * FROM [pc]" UpdateCommand="UPDATE [pc] SET [naam]
> = ?, [defect] = ?, [type] = ?, [software] = ?, [lokaal] = ? WHERE [pcnr] =
> ? AND [naam] = ? AND [defect] = ? AND [type] = ? AND [software] = ? AND
> [lokaal] = ?">
> <DeleteParameters>
> <asp:Parameter Name="original_pcnr" Type="Int32" />
> <asp:Parameter Name="original_naam" Type="String" />
> <asp:Parameter Name="original_defect" Type="Boolean" />
> <asp:Parameter Name="original_type" Type="String" />
> <asp:Parameter Name="original_software" Type="String" />
> <asp:Parameter Name="original_lokaal" Type="String" />
> </DeleteParameters>
> <UpdateParameters>
> <asp:Parameter Name="naam" Type="String" />
> <asp:Parameter Name="defect" Type="Boolean" />
> <asp:Parameter Name="type" Type="String" />
> <asp:Parameter Name="software" Type="String" />
> <asp:Parameter Name="lokaal" Type="String" />
> <asp:Parameter Name="original_pcnr" Type="Int32" />
> <asp:Parameter Name="original_naam" Type="String" />
> <asp:Parameter Name="original_defect" Type="Boolean" />
> <asp:Parameter Name="original_type" Type="String" />
> <asp:Parameter Name="original_software" Type="String" />
> <asp:Parameter Name="original_lokaal" Type="String" />
> </UpdateParameters>
> </asp:SqlDataSource>
>
> <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
> AllowSorting="True" PageSize="14" width="990px"
> AutoGenerateColumns="False" CellPadding="4" DataKeyNames="pcnr"
> DataSourceID="SqlDataSource1"
> ForeColor="#333333" GridLines="None">
> <Columns>
> <asp:CommandField ShowEditButton="True" />
> <asp:TemplateField>
> <ItemTemplate>
> <asp:LinkButton ID="lb1" runat="server"
> OnClientClick="return confirm(yes?');"
> CommandName="Delete">
> </asp:LinkButton>
> </ItemTemplate>
> </asp:TemplateField>
> <asp:BoundField DataField="pcnr" HeaderText="pcnr"
> InsertVisible="False" ReadOnly="True"
> SortExpression="pcnr" />
> <asp:BoundField DataField="naam" HeaderText="naam"
> SortExpression="naam" />
> <asp:CheckBoxField DataField="defect" HeaderText="defect"
> SortExpression="defect" />
> <asp:BoundField DataField="type" HeaderText="type"
> SortExpression="type" />
> <asp:BoundField DataField="software" HeaderText="software"
> SortExpression="software" />
> <asp:BoundField DataField="lokaal" HeaderText="lokaal"
> SortExpression="lokaal" />
> </Columns>
> </asp:GridView>
>
>
>
>





All times are GMT. The time now is 02:23 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.