473,569 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datatable clear

Good day Group,
I have a form with a datagrid and two buttons. On show button
datagrid is populated with a datatable and on
clear button datagrid is cleared. DataTable.Clear not only removes
all of the data from the DataTable, it clears the dataset as well.
Why datatable.clear sets dataset to 0 rows?

Thanks
Ian
Jun 27 '08 #1
4 1701
Ian,

Is the content of your dataset only one datatable, or more datatables which
in fact reference all to the same?

Cor

<in*****@hotmai l.comschreef in bericht
news:ad******** *************** ***********@i18 g2000prn.google groups.com...
Good day Group,
I have a form with a datagrid and two buttons. On show button
datagrid is populated with a datatable and on
clear button datagrid is cleared. DataTable.Clear not only removes
all of the data from the DataTable, it clears the dataset as well.
Why datatable.clear sets dataset to 0 rows?

Thanks
Ian
Jun 27 '08 #2
Thanks Cor for your respone.

It's one datatable as follows:

adapter.Fill(da taset1)
datatable1 = dataset1.Tables (0)
DataGridView1.D ataSource = datatable1.Defa ultView

Ian
Jun 27 '08 #3
Ian,

A dataset is just a wrapper around a datatable as it is only one.

The advantage is than only that you can easily serialize a datatable to a
XML file.

Cor

<in*****@hotmai l.comschreef in bericht
news:e0******** *************** ***********@v26 g2000prm.google groups.com...
Thanks Cor for your respone.

It's one datatable as follows:

adapter.Fill(da taset1)
datatable1 = dataset1.Tables (0)
DataGridView1.D ataSource = datatable1.Defa ultView

Ian
Jun 27 '08 #4
Thanks Cor for the clarification.
Jun 27 '08 #5

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

Similar topics

12
2268
by: Doug Bell | last post by:
Hi, I am having problems trying to create a (temporary) DataTable from a selection from a DataGrid (dgOrders). dtOrdDetails is declared as a Public DataTable Sub is: Dim stFilter as String Dim OrdersRows() as DataRow
1
1498
by: Simon | last post by:
Hi All, I have a DataGrid bound to a DataTable. Every once in a while I need to refresh the data in the table so that the updated data is displayed in the DataGrid. Here's how I am attempting this: 'clear datatable datatbl.Rows.Clear() If PLCCount() <> 0 Then
6
1693
by: Danny Ni | last post by:
Hi, If I want to programatically add rows to a DataTable, do I call AcceptChanges per row? Or do I call AcceptChanges after all rows added? TIA
0
4826
by: Flack | last post by:
I have pasted at the end of this message a small sample program I whipped up to do some testing. It's a form with a datagrid and two buttons. Each button clears the dataTable that is the source of the dataGrid, and then adds five rows. Button2 is the same as button1 just that it does this in a different thread (I was testing if I was...
4
7677
by: Brett Romero | last post by:
I fill a DataTable with search results, which take a very long time if I first clear it. The values come from an object and I map them into the corresponding table columns. I may have 65000 results. I iterate through them, create a new row, fill it, and add it to the DataTable for each interation. This works fine on the first search. ...
4
2945
by: Adrian Parker | last post by:
We've suddenly started getting a problem with a call to clear the contents of a DataTable. This is on a live customer site that's been working fine until yesterday. As far as we know they've not changed or updated the server in any way. "There is no row at position 42" at System.Data.RBTree`1.GetNodeByIndex(int32 userIndex) at...
8
11037
by: cj | last post by:
I have a program to display queries to a SQL db. I type my query in a textbox and click a button and the results display in a datagrid. I could use either dataset or datatable to read the data in then I make the datagrid.datasource = myds.Tables(0) or mydt. Now what I want is to be able to change the query and click the button again and get...
0
2294
by: XenReborn | last post by:
Ok this should be simple. I made a form, added a combobox (for selecting items to edit, not for updating fields), several textboxes, a few checkboxes etc. On formshow it connects to my database, draws down the existing data, no problem. All the records in the datatable that were the result of a query, I could select from, and the other databound...
1
6734
by: tshad | last post by:
Running on VS.net 2005, I am trying to copy rows from my datatable to another datatable in the same dataset. The schema would be identical. I need to make the table name "forms" as I am passing this dataset to function that expects a dataset with a datatable in it.
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.