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

Delete records from dataset

I have a dataset that I do not want written back to the table. I need to
delete rows from the dataset where to fields are equal...example

Dataset1
bridge <---- pk
amt
rec

if amt =rec , i want to delete / remove the record but cant figure it out

any help will be appreciated

Steve

Nov 21 '05 #1
3 15689
Hi Stephen,

Dim irow as datarow
For each irow in ds1.tables(0).rows
if irow("amt") = irow("rec") then
irow.delete()
end if
Next

HTH,

Bernie Yaeger

"Stephen" <St******@xjohnstontrading.com> wrote in message
news:eG**************@TK2MSFTNGP14.phx.gbl...
I have a dataset that I do not want written back to the table. I need to
delete rows from the dataset where to fields are equal...example

Dataset1
bridge <---- pk
amt
rec

if amt =rec , i want to delete / remove the record but cant figure it out

any help will be appreciated

Steve

Nov 21 '05 #2
Bernie... that did the trick....

thank you

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
Hi Stephen,

Dim irow as datarow
For each irow in ds1.tables(0).rows
if irow("amt") = irow("rec") then
irow.delete()
end if
Next

HTH,

Bernie Yaeger

"Stephen" <St******@xjohnstontrading.com> wrote in message
news:eG**************@TK2MSFTNGP14.phx.gbl...
I have a dataset that I do not want written back to the table. I need to
delete rows from the dataset where to fields are equal...example

Dataset1
bridge <---- pk
amt
rec

if amt =rec , i want to delete / remove the record but cant figure it out
any help will be appreciated

Steve


Nov 21 '05 #3
Stephen,

Bernie gave the solution, however there is a big difference in removing a
row and deleting a row.

When you want to remove a row from a dataset that will not be deleted in the
database in the next dataadapter update. Therefore is the instruction
"remove" and you understand it already when you use "delete" it will be
removed from the database in the next update. In that update command, it
will than be removed by the dataadapter when done. (or by the acceptchanges
when you use not the complete dataset in the update and you use that).

A "delete" set the rowstate to delete (when it is not created new in that
session, because than it is removed)
A "remove" removes forever the row so there is no rowstate anymore.

I hope this gives some idea's

Cor
Nov 21 '05 #4

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

Similar topics

2
by: Imayakumar | last post by:
Hi , i fetched some records from SQL Server using data adapter and filled it to the dataset. now i want to add some rows to the dataset and reflect it to the database.. i can do it perfectly with...
0
by: Job Lot | last post by:
My DataGrid is bound to a DataSet and showing only those records whose Client_Liability_ID IS NULL and I am using RowFilter to do so. Following is the code: 'Set Select Command for WithdrawalDA....
2
by: NoSpam | last post by:
Hi, I am working with C# and ASP.NET with code behind and a SQL Server. I'm making an e-shop. When clients see what they have in their basket, I added a function DELETE to delete a line. It took...
6
by: Mark Kurten | last post by:
for some reason when i delete a row, the row doesn't get deleted from the acutal data table in SQL server. my code follows what am i missing? thanks. Dim row As DataRow Try
1
by: Kashif Mehmood | last post by:
Greeting I am using the following code to delete a row from a datagrid ---------------- Private Sub dgClientTypes_DeleteCommand(ByVal source As Object, ByVal e As...
3
by: Phi | last post by:
Hi, I hope somebody could help me with this problem. I would like to make a form to add and delete records from my ms access database. I've found most of the codes from the internet and...
0
by: HS1 | last post by:
Hello all I have a DataGrid1 presenting records of a table ("clients") in a Access Database through a DataSet (ds) using DataAdapter (da1) and buttons "add", "save" and"delete" buttons with the...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.