.NETGURU
Problem with delete - OleDbDataAdapter.Update
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-oledb' list.


Sissel
-- Copied from [aspngfreeforall] to [ngfx-oledb] by Charles M. Carroll <Click here to reveal e-mail address> --I am trying to delete a row from a datatable using OleDbDataAdapter.UpdateI manage to add rows and change in rows, but for some reason Deleted rowsare still there.This is the code. (simplified)Any ideas?Private Sub btn_delete_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles btn_delete.ClickDim v_conn As New OleDbConnection("Provider=MSDAORA.1; DataSource=bid817.world; User ID=eacost; Password=oracle")Dim v_ds As New DataSet()Dim v_adapter As New OleDbDataAdapter("select * from cc_vor_impact", v_conn)Dim v_builder As OleDbCommandBuilderv_builder = New OleDbCommandBuilder(v_adapter)v_conn.Open()v_adapter.Fill(v_ds, "cc_vor_impact")Dim v_table As New DataTable()v_table = v_ds.Tables("cc_vor_impact")Dim v_cnt As Integerv_cnt = v_table.Rows.Count - 1Dim delRow As DataRow = v_table.Rows(v_cnt) 'Delete last rowv_table.Rows.Remove(delRow)v_adapter.Update(v_ds, "cc_vor_impact")v_conn.Close()End Sub
Reply to this message...
 
    
Daniel Naumann
Not sure if this is your problem but doing a Row.Remove, removes the row from the datatable, so when
you do the update these rows in the actual database table will be left alone. You may need to use
Row.Delete which marks the datarow for deletion but doesn't actually remove it from the datatable.
Then when you do the update they should be removed from the database table. I haven't tried it
myself, but I've read about it :)

Daniel.

-----Original Message-----
From: Sissel [mailto:Click here to reveal e-mail address]
Sent: 18-Jan-2002 11:25
To: ngfx-oledb
Subject: [ngfx-oledb] Problem with delete - OleDbDataAdapter.Update

-- Copied from [aspngfreeforall] to [ngfx-oledb] by Charles M. Carroll
<Click here to reveal e-mail address> --

I am trying to delete a row from a datatable using OleDbDataAdapter.Update

I manage to add rows and change in rows, but for some reason Deleted rows
are still there.

This is the code. (simplified)
Any ideas?

Private Sub btn_delete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_delete.Click

Dim v_conn As New OleDbConnection("Provider=MSDAORA.1; Data
Source=bid817.world; User ID=eacost; Password=oracle")

Dim v_ds As New DataSet()

Dim v_adapter As New OleDbDataAdapter("select * from cc_vor_impact", v_conn)

Dim v_builder As OleDbCommandBuilder

v_builder = New OleDbCommandBuilder(v_adapter)

v_conn.Open()

v_adapter.Fill(v_ds, "cc_vor_impact")

Dim v_table As New DataTable()

v_table = v_ds.Tables("cc_vor_impact")

Dim v_cnt As Integer

v_cnt = v_table.Rows.Count - 1

Dim delRow As DataRow = v_table.Rows(v_cnt) 'Delete last row

v_table.Rows.Remove(delRow)

v_adapter.Update(v_ds, "cc_vor_impact")

v_conn.Close()

End Sub

| [ngfx-oledb] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-oledb.asp = JOIN/QUIT

Reply to this message...
 
 
System.Data.DataRow
System.Data.DataSet
System.Data.DataTable
System.Data.OleDb.OleDbCommandBuilder
System.Data.OleDb.OleDbConnection
System.Data.OleDb.OleDbDataAdapter
System.EventArgs
System.Object




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification