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

Using Dataset.Clear() to clear an SQL-database

Is it possible to use

dataset.Clear();
dataAdapterSomething.Update(dataset.table);

to clear a table in an SQL database?

I am not able to get this to work. The dataset clears, but the changes
are not updated into the database.

Nov 15 '06 #1
3 6362
You would have to mark each row for deletion. Clearing the dataset
physically removes all the rows.

"Cub71" <bj*****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Is it possible to use

dataset.Clear();
dataAdapterSomething.Update(dataset.table);

to clear a table in an SQL database?

I am not able to get this to work. The dataset clears, but the changes
are not updated into the database.

Nov 15 '06 #2
Just use a SqlCommand to run either
Delete From TableName
if the table is referenced by foreign key constraints.
If it isnt:
Truncate Table TableName

Truncate also resets Identity columns whereas delete doesnt.

Ciaran O'Donnell

"Cub71" wrote:
Is it possible to use

dataset.Clear();
dataAdapterSomething.Update(dataset.table);

to clear a table in an SQL database?

I am not able to get this to work. The dataset clears, but the changes
are not updated into the database.

Nov 15 '06 #3

Ciaran O''Donnell skrev:
Just use a SqlCommand to run either
Delete From TableName

Thank you. That is what I ended up doing.

Nov 15 '06 #4

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

Similar topics

1
by: Ramki | last post by:
hi guys, How to Add a Blank row in a datagrid without using dataset Please reply ASAP. Very urgent. Thanks inadvance.
16
by: Vibhu | last post by:
Hello All, I am trying to update a database using dataset but seems that I am missing out something. After going through a lot of posts and checking my code, I am still at my wits end to figure...
0
by: ksrajalakshmi | last post by:
Hai, I've displayed all data in a datagrid. the datasource is a dataset. the user can modify the data in the datagrid. the updated data in the datagrid to be updated in datatable. i used the...
0
by: =?Utf-8?B?UHJhYmFrYXIgU2FtaXlhcHBhbg==?= | last post by:
I need to add a new to the asp.net datagrid without using dataset .Since when we use dataset to add row it took more time to load the records.Gimme a Solution .thanks
1
by: sachinkale123 | last post by:
Hi I am working in a Windows C# application. I m using Dataset. But whenever I updated the dataset it gets updated. I can see the changes in dataset but using SQLAdapter.Update(Dataset) command It is...
1
by: raghudr | last post by:
Hi all, I am parsing an .xml file.My main intention is to retrieve the field value:- "Name Value" which is "rag" and store it in a List. Fot that i wrote code like this: //i am using...
2
by: masajid686 | last post by:
hi frnds I written the code for inserting records in sqlserver 2005 using dataset and command builder but i dont know hot write sp for that one. can anybody tellme Thanks
0
by: SLauren | last post by:
Hi, I am new to crystal report. Can anyone please suggest how can i generate a crystal report using dataset without a report object? I have a crystal report (.rpt) with a mapped dataset. How can...
2
by: phanimadhav | last post by:
Hello Experts, I developed following code for excel file creation by using Dataset.But i got the following error(NullRefernec Exception was caught) at the response.End() My...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.