473,396 Members | 1,861 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,396 software developers and data experts.

Deleted row is not deleted (using DataSet)

Hi everyone,

I'm a newbie in VB.net. I have a problem, when I delete a row (using DtTbl.Rows.Remove(DtRow) syntax), and then I save the records into Database (using DtAdapter.Update(Dtset, "TblNm") syntax), the deleted record is still exist.

Please tell me, what should I do to fix this problem, thanks before...

Here is my code :
Expand|Select|Wrap|Line Numbers
  1. Private Sub CmdDelDtl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdDelDtl.Click
  2.     Dim TblDel As DataTable = DtSetDt.Tables("TblNm")
  3.  
  4.     Dim idx As Integer
  5.     idx = DtGrid.CurrentRowIndex()
  6.  
  7.     Dim RowDel As DataRow = TblDel.Rows(idx)
  8.     TblDel.Rows.Remove(RowDel)
  9.  
  10. End Sub
  11.  
  12. Private Sub CmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSave.Click
  13.  
  14.     ''--Open the Connection
  15.     ConnOpen()
  16.  
  17.     ''--Save into DB
  18.     DtAdapDt.Update(DtSetDt, "TblNm")
  19.  
  20.     Conn.Close()
  21.  
  22. End Sub
  23.  
Sep 8 '08 #1
1 1487
Frinavale
9,735 Expert Mod 8TB
It looks as if you're doing everything correctly.
Are you getting any error messages or exceptions?

Have you seen this article on How to save dataset changes?

-Frinny
Sep 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if...
2
by: raffe | last post by:
Hi all. I'm struggeling with a problem. I trying to do something very simple. I have a DataSet containing two tables TableA and TableB. I use TableA.GetChildren("relationName") in order to get...
1
by: Ray Martin | last post by:
I have two tables in the dataset: -Invoice header which contains invoice total (Parent table) -Invoice line which contains line item details (Child table) I am using a data adapter to update the...
4
by: Rodger Dusatko | last post by:
After entering the sql statement da.deletecommand.commandtext = "Delete from Users where username = @username" I set the parameter to the username I wish to delete. This successfully deletes the...
3
by: Zorpiedoman | last post by:
Is this true: An existing row in a data table that is deleted still exists in the rows collection, but it is marked as deleted (rowstate = deleted) But If a row that was added to the data...
4
by: Joris De Groote | last post by:
Hi, (my code is @ the bottom of this message) I have a piece of code that runs the rows of a dataset until it finds the one needed. When he finds it, I delete that row and start all over...
0
by: Irfan | last post by:
hi, I have a peculiar behaviour in my DataTable_RowDeleting Event. When i delete the row first time, this.DataSet.hasChanges(DataRowState.Deleted) evaluates to false, and therefore is unable to...
0
by: ZSvedic | last post by:
Hi all, I need to display DataRows with RowState.Deleted inside DataGridView, in a way that such rows have strikethrough font. Here is the screenshot how it should look like:...
4
codemama
by: codemama | last post by:
I have created xml files in C# using the DataSet ds.WriteXml method. I now need to take an xml file and be able to do an insert or delete to a table in MS Access. How would I go about that? Do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.