473,654 Members | 3,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datatable updating pbs.

fh
Hello,

I modify one row of a datatable
with this code

DataRow drCurrent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
drCurrent.Begin Edit();
drCurrent["Automatic"]=txbCAuto.Text;
drCurrent["DowntimeSt art"]=txbbeg.Text;
drCurrent["DowntimeEn d"]=txbEnd.Text;
drCurrent.EndEd it();

but i can't see any change when I reload the data
even if i request for their current state

Franck
Nov 17 '05 #1
4 2146
Franck,

Calling BeginEdit and EndEdit doesn't commit the changes to the
database. The DataSet is disconnected, meaning that the data you have in
the DataSet is not connected to the database it came from in any way.

In order to update the records, you have to pass the dataset to a
DataAdapter (preferably, the one you used to select the data) through the
Update method.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"fh" <fh@fh.com> wrote in message news:de******** **@s1.news.olea ne.net...
Hello,

I modify one row of a datatable
with this code

DataRow drCurrent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
drCurrent.Begin Edit();
drCurrent["Automatic"]=txbCAuto.Text;
drCurrent["DowntimeSt art"]=txbbeg.Text;
drCurrent["DowntimeEn d"]=txbEnd.Text;
drCurrent.EndEd it();

but i can't see any change when I reload the data
even if i request for their current state

Franck

Nov 17 '05 #2
fh
thanks for your answer
but when I wrote, reload the data,
I meant from the dataset modified (apparently not...)

Nicholas Paldino [.NET/C# MVP] wrote:
Franck,

Calling BeginEdit and EndEdit doesn't commit the changes to the
database. The DataSet is disconnected, meaning that the data you have in
the DataSet is not connected to the database it came from in any way.

In order to update the records, you have to pass the dataset to a
DataAdapter (preferably, the one you used to select the data) through the
Update method.

Hope this helps.

Nov 17 '05 #3
fh,

If you change a value on a column in a row, then the row state of the
row should change automatically.

Are you filtering on the rowstate perhaps and you don't know it?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"fh" <fh@fh.com> wrote in message news:de******** **@s1.news.olea ne.net...
thanks for your answer
but when I wrote, reload the data,
I meant from the dataset modified (apparently not...)

Nicholas Paldino [.NET/C# MVP] wrote:
Franck,

Calling BeginEdit and EndEdit doesn't commit the changes to the
database. The DataSet is disconnected, meaning that the data you have in
the DataSet is not connected to the database it came from in any way.

In order to update the records, you have to pass the dataset to a
DataAdapter (preferably, the one you used to select the data) through the
Update method.

Hope this helps.


Nov 17 '05 #4
fh
Nicholas Paldino [.NET/C# MVP] wrote:
fh,

If you change a value on a column in a row, then the row state of the
row should change automatically.

Are you filtering on the rowstate perhaps and you don't know it?

thank you for your answer,
in fact no
to view my data i use:

txbDate.Text=
drLigneCourante["ValidationDate ",DataRowVersio n.Current].ToString();

so the state is current
Nov 17 '05 #5

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

Similar topics

6
4230
by: Stephan Steiner | last post by:
Hi I have written a .NET service that uses two DataTables to store runtime data. One column in one table is periodically updated (every 10 seconds, and upon user request), another is updated upon user action. The code works fine most of the time. I've had it running on a W2K server for over half a year with little issues. Though when running the same code on a W2K3 server, I regularly get IndexOutofRange exceptions at random intervals...
1
2965
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in a DataGrid, and set the PrimaryKey of the DataTable to be the first cell in the grid (which is a UserID value). I then store the DataTable in a session object, from which it is retrieved for subsequent pages. All this seems to be working fine. ...
8
5349
by: Greg Peck | last post by:
Hi I need to update a field (fldX) in one DataTable (dt1) where there is a match on fldA in another DataTable (dt2). Is the only way to do this by itterating through the DataRows of dt1, serching dt2 for a matching fldA and if found do the update and then move on to the next row? Thanks Greg
1
19769
by: Lars E | last post by:
Hi all I have a small problem. I have a datatable with 8 columns. But it is only data in 5 of the columns. Data for the remaing 3 columns is in another dataset. I Want to run trough the datatable and fill out the remaining data. My code so far: if (this.fetch("custinfo", "fetchCustInfo", out customers, parameters))
3
5132
by: Carlos Cruz | last post by:
Hi, I've a DataGridView with Datasourse = Datatable. The problem is that I can't get my last record updated at the database unless I change the row where I'm editing... Can anyone explain me why and how can I manage to get rid of this? By the way, Im' updating with DataAdapter.Update(DataTable) Thanks in advance
0
1767
by: Maart_newbie | last post by:
Hi all, I've got a question about returning the value of a pk-column to a DataTable after inserting a row (via a data-adapter) using MySql5. Here is the SQL and code concerned: //=================================================================== // The table
1
8208
by: joel | last post by:
hi guys... i am a student, i am studying and i am a newbie in VB.net and i am using SQL Server 2000. I have this datatable which i insert rows (may take up to 2 or more rows because i would like to perform batch updating). upon clicking of update button, i would like to insert them all in a table in my database.
0
1467
by: Chet | last post by:
I have a Datagrid that is bound to a Datatable at runtime. I allow the user to select a number of rows using the mouse and then click a button that says "check selected rows", which then cycles through the selected rows and sets a check box field in the datagrid (and thus the databound datatable) to checked/true. It works like this: Dim cel As DataGridViewCheckBoxCell For Each row In DataGrid.SelectedRows cel = row.Cells(0) cel.Value =...
0
1224
LoanB
by: LoanB | last post by:
Hey guys need some info here. I am adding, updating and deleting data on a datagrid. I pass the datagrid's datasource (datatable dt) to my data layer. Assuming I have already created and opened a connection in a business layer and passed it to my datalayer I am now stuck here: My business layer code is as follows: //UPDATE MATRIX STOCK DATA TO SQL DATABASE public void updateMatrixData(System.Data.DataTable dt)
1
1930
by: Wavey | last post by:
Hi All, I have a problem with updating an Access database from a datatable. I have two rows of data in my database at the moment for testing, the first row is an ID number (primary key), the second is a name and the third is a price. I can get this data out of the database, store it in a datatable in a dataset and display the name in a listbox with the name and price displayed in textboxes. If I change the data for the second row data...
0
8375
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8482
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6161
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.