473,831 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConflictDetecti on="CompareAllV alues"
ConnectionStrin g="Provider=Mic rosoft.Jet.OLED B.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 (?, ?, ?, ?, ?, ?)"
OldValuesParame terFormatString ="original_{ 0}"
ProviderName="S ystem.Data.OleD b"
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] = ?">
<DeleteParamete rs>
<asp:Paramete r Name="original_ pcnr" Type="Int32" />
<asp:Paramete r Name="original_ naam" Type="String" />
<asp:Paramete r Name="original_ defect" Type="Boolean" />
<asp:Paramete r Name="original_ type" Type="String" />
<asp:Paramete r Name="original_ software" Type="String" />
<asp:Paramete r Name="original_ lokaal" Type="String" />
</DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="naam" Type="String" />
<asp:Paramete r Name="defect" Type="Boolean" />
<asp:Paramete r Name="type" Type="String" />
<asp:Paramete r Name="software" Type="String" />
<asp:Paramete r Name="lokaal" Type="String" />
<asp:Paramete r Name="original_ pcnr" Type="Int32" />
<asp:Paramete r Name="original_ naam" Type="String" />
<asp:Paramete r Name="original_ defect" Type="Boolean" />
<asp:Paramete r Name="original_ type" Type="String" />
<asp:Paramete r Name="original_ software" Type="String" />
<asp:Paramete r Name="original_ lokaal" Type="String" />
</UpdateParameter s>
</asp:SqlDataSour ce>

<asp:GridView ID="GridView1" runat="server" AllowPaging="Tr ue"
AllowSorting="T rue" PageSize="14" width="990px"
AutoGenerateCol umns="False" CellPadding="4" DataKeyNames="p cnr"
DataSourceID="S qlDataSource1"
ForeColor="#333 333" GridLines="None ">
<Columns>
<asp:CommandFie ld ShowEditButton= "True" />
<asp:TemplateFi eld>
<ItemTemplate >
<asp:LinkButt on ID="lb1" runat="server"
OnClientClick=" return confirm(yes?'); "
CommandName="De lete">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="pcnr " HeaderText="pcn r"
InsertVisible=" False" ReadOnly="True"
SortExpression= "pcnr" />
<asp:BoundFie ld DataField="naam " HeaderText="naa m"
SortExpression= "naam" />
<asp:CheckBoxFi eld DataField="defe ct" HeaderText="def ect"
SortExpression= "defect" />
<asp:BoundFie ld DataField="type " HeaderText="typ e"
SortExpression= "type" />
<asp:BoundFie ld DataField="soft ware" HeaderText="sof tware"
SortExpression= "software" />
<asp:BoundFie ld DataField="loka al" HeaderText="lok aal"
SortExpression= "lokaal" />
</Columns>
</asp:GridView>


Jul 31 '06 #1
1 1856
I found it.
All the fields must be filled ..
"Marc" <mm*@ze.azschre ef in bericht
news:%2******** ********@TK2MSF TNGP02.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:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConflictDetecti on="CompareAllV alues"
ConnectionStrin g="Provider=Mic rosoft.Jet.OLED B.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 (?, ?, ?, ?, ?, ?)"
OldValuesParame terFormatString ="original_{ 0}"
ProviderName="S ystem.Data.OleD b"
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] = ?">
<DeleteParamete rs>
<asp:Paramete r Name="original_ pcnr" Type="Int32" />
<asp:Paramete r Name="original_ naam" Type="String" />
<asp:Paramete r Name="original_ defect" Type="Boolean" />
<asp:Paramete r Name="original_ type" Type="String" />
<asp:Paramete r Name="original_ software" Type="String" />
<asp:Paramete r Name="original_ lokaal" Type="String" />
</DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="naam" Type="String" />
<asp:Paramete r Name="defect" Type="Boolean" />
<asp:Paramete r Name="type" Type="String" />
<asp:Paramete r Name="software" Type="String" />
<asp:Paramete r Name="lokaal" Type="String" />
<asp:Paramete r Name="original_ pcnr" Type="Int32" />
<asp:Paramete r Name="original_ naam" Type="String" />
<asp:Paramete r Name="original_ defect" Type="Boolean" />
<asp:Paramete r Name="original_ type" Type="String" />
<asp:Paramete r Name="original_ software" Type="String" />
<asp:Paramete r Name="original_ lokaal" Type="String" />
</UpdateParameter s>
</asp:SqlDataSour ce>

<asp:GridView ID="GridView1" runat="server" AllowPaging="Tr ue"
AllowSorting="T rue" PageSize="14" width="990px"
AutoGenerateCol umns="False" CellPadding="4" DataKeyNames="p cnr"
DataSourceID="S qlDataSource1"
ForeColor="#333 333" GridLines="None ">
<Columns>
<asp:CommandFie ld ShowEditButton= "True" />
<asp:TemplateFi eld>
<ItemTemplate >
<asp:LinkButt on ID="lb1" runat="server"
OnClientClick=" return confirm(yes?'); "
CommandName="De lete">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="pcnr " HeaderText="pcn r"
InsertVisible=" False" ReadOnly="True"
SortExpression= "pcnr" />
<asp:BoundFie ld DataField="naam " HeaderText="naa m"
SortExpression= "naam" />
<asp:CheckBoxFi eld DataField="defe ct" HeaderText="def ect"
SortExpression= "defect" />
<asp:BoundFie ld DataField="type " HeaderText="typ e"
SortExpression= "type" />
<asp:BoundFie ld DataField="soft ware" HeaderText="sof tware"
SortExpression= "software" />
<asp:BoundFie ld DataField="loka al" HeaderText="lok aal"
SortExpression= "lokaal" />
</Columns>
</asp:GridView>


Jul 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2234
by: Alex | last post by:
Hi, hi have a table with 2.5 million records which i try do delete. i have several constraints on it too. i tried to delete the records using delete but it does not seem to work. the delete runs forever. hrs... i cannot truncate it as it complains about foreign keys. What is the problem ? Thanks
1
2036
by: P | last post by:
Hello, I am having a difficult time updating a record via a stored procedure using the gridview and sqldatasource. I cannot seem to be able to find a way to set everything up so that I can pass the applicable fields in the gridview to a sqldatasource which in turn calls a sproc with the appropriate parameters and data. Any ideas? Thanks in advance,
2
4388
by: David Ching | last post by:
I am not getting any response to my previous question on reusing a DetailsView to insert and edit the selected row in a GridView. So I'll ask an even more basic question. Newbie alert! ;) When the user clicks the Edit link in a GridView, is it common to use a DetailsView to edit that row instead of putting the GridView into Edit mode and editing the row in place? I would assume so, because the GridView does not typically have columns...
0
1008
by: cathal670 | last post by:
Here is the link to a zip file containing my web site, database is in the database folder My Web Site To download it, type in the verification text, wait the 30 second delay and press the grey download button. The problem I am having is that I cannot write any new records to the database, or edit it or delete them. I am hoping that someone could run the web site on their machine and tell me what is wrong with it. I think it may be a...
5
3947
by: sh26 | last post by:
I can Add and Delete (A, CName, MX and TXT) Dns records on the Dns Server using C# code. The problem I am having is if someone manaully creates a TXT record on the Dns Server, I cannot delete that particular record using the same C# code. Here is what I am using to delete the records: public void DeleteRecord(string domain, string recordName, string recordType, string recordData) { try { ...
2
5343
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like what hotmail web UI is doing now (having the option of selecting multiple rows (using the checkbox provided) and perform a set of operations on them)
0
1148
by: Andy B | last post by:
Is there any simple examples of edit/deleteing rows in a GridView that has its datasource set to an xml object? I need to know, because the project I'm working on doesn't call for a database but more of xml type of storage.
0
1226
by: Andy B | last post by:
I have a GridView in asp.net. I want to set its datasource to some xml content. At the same time, I need to know how to insert/delete/edit content in the GridView rows and then repopulate the xml source to reflect the changes made in the gridView. Is there any simple examples of doing something like this or can somebody create one for me? Thanks for the help...
11
4484
by: bala venkata siva ram kum | last post by:
I am facing a problem while clicking edit button of a gridview.after clicking edit button it is displaying empty textboxes. I need old values in that textboxes. Here i used 3-tier architecture. Below is my code: /***Application layer***/ protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e) { GridView2.EditIndex = e.NewEditIndex; GridView2.DataSource =...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10494
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10534
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7748
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5620
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.