473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Datagrid Delete Problem

I have a webform in VB.NET that
contains a Datagrid control.
My datagrid has buttons for updates
and deletes.
The updates work fine, but the deletes
are not being updated in the DB for
some reason. I see the changes
in the datagrid, but when I restart
the app., the row is back.

Here is all the info you might need:

Components:

- Access DB
- OleDBDataAdapter1
- OleDBConnection1
- Dataset1
- grdData

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

OleDbDataAdapter1.Fill(DataSet1)

If Not IsPostBack Then
grdData.DataBind()
End If

End Sub

Private Sub grdData_DeleteCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
grdData.DeleteCommand

Dim key As String = grdData.DataKeys(e.Item.ItemIndex).ToString()

Dim r As DataSet1.PeopleRow
r = DataSet1.People.FindByName(key)

r.Delete()
DataSet1.AcceptChanges()
OleDbDataAdapter1.Update(DataSet1)

grdData.DataBind()

End Sub

--
Will Cooper
Application Programmer
Nov 19 '05 #1
0 838

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

Similar topics

9
by: Pam Ammond | last post by:
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow deleting a Size using a datagrid, and then return to frmSize and want to update the datagrid in frmSize to reflect the...
3
by: Ryan Liu | last post by:
Hi there, I got a NullReferenceException when delete last row in a datagrid. I had hard time to solve since it does not occur in my own code. I put a datagrid in my inherited user control,...
0
by: Curtis Hatter | last post by:
I apologize if this has been answered, but on the .NET 247 site I saw a thread titled "Datagrid's ItemCommand Event", and had similar troubles with the Datagrid not properly firing the delete event...
0
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass =...
4
by: Rod | last post by:
I posted a message to this group yesterday asking how to pass parameters to a web form that is the source of an IFrame on a parent web form. I've gotten my answer, and it works. Thanks! Now I...
4
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid...
0
by: laurent | last post by:
Environment: VS NET 2003 Fr Framework: 1.1 OS: WinXP SP2 Fr Hello I have a problem to add with pop-up and to delete in a datagrid(ButtonColumn delete) on WebForms. code button HTML which...
5
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.