Dim drTemp As DataRow
For Each drTemp In dtInvCharges.Se lect("invno ='" &
Me.txtInvNo.Tex t.Trim & "' ")
dtInvCharges.Ro ws.Remove(drTem p)
Next
I got a "Delete button" to delete all rows in that Table. and the process
"SAVE", In the screen , i can see the datagrid got nothing,
however, as i check back my table in SQL, The data still here ?? Please
help
bmInvInfo.EndCu rrentEdit()
If dsInvInfo.HasCh anges() Then
daInvChg.Update (dsInvInfo, strdtChg)
daInvInfo.Updat e(dsInvInfo, strdtInfo)
dsInvInfo.Accep tChanges()
ENDIF 3 11588
Agnes,
I thought that I had answered this question already 9 months ago to you http://groups.google.com/group/micro...dd12fa1f12e784
A 'remove' removes a datarow from a datatable, therefore with an update it
cannot remove it from the database because there is nothing more.
A delete marks a not newly added datarow as to delete. After an update of
that original datatable or an acceptchanges the datarow will be removed from
the datatable.
I don't know if this helps now, however I hope it.
:-)
Cor
You removed the rows. Not marked them as deleted. So as far as the datatable
is concerned, it has no rows in it - and no changes to send. Call the
Delete method on the rows you want to delete.
"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:uA******** ******@TK2MSFTN GP09.phx.gbl... Dim drTemp As DataRow For Each drTemp In dtInvCharges.Se lect("invno ='" & Me.txtInvNo.Tex t.Trim & "' ") dtInvCharges.Ro ws.Remove(drTem p) Next I got a "Delete button" to delete all rows in that Table. and the process "SAVE", In the screen , i can see the datagrid got nothing, however, as i check back my table in SQL, The data still here ?? Please help bmInvInfo.EndCu rrentEdit() If dsInvInfo.HasCh anges() Then daInvChg.Update (dsInvInfo, strdtChg) daInvInfo.Updat e(dsInvInfo, strdtInfo) dsInvInfo.Accep tChanges() ENDIF
doh,
Although that answer was AFAIK now wrong.
Now I know that a delete from a datagrid using the AltKey does a delete.
Nevertheless is a remove as in your code the remove I was refering to.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: baylor |
last post by:
i have a DataSet (TDS). It has 4 rows in it. i want to erase those. For the
life of me i can't figure out how
Option 1: foreach
foreach (DataRow row in dataSet.MY_TABLE.Rows) {
row.Delete();
}
This doesn't work. It erases the first row and then throws the exception
Someone Changed The Enumerator. No fun
|
by: Mark Jones |
last post by:
I'm trying to delete a row from a DataGrid using a ButtonColumn with
CommandName="Delete" by deleting the row in the underlying DataTable
datasource, but it doesn't seem to be working at the minute. I'm using
session data to fill the DataTable which subsequently fills the DataGrid.
The code is as follows (with "dgBasket" as the DataGrid):
private void dgBasket_DeleteCommand(object source,...
|
by: Mark Jones |
last post by:
I'm trying to delete data from a DataGrid using a ButtonColumn with a
CommandName="Delete" but it's not working a the min. I'm using session data
which fills a DataTable which then fills the DataGrid. The code is as
follows (dgBasket is the DataGrid):
private void Page_Load(object sender, System.EventArgs e)
{
DataTable myTable = (DataTable) Session;
|
by: Vijay Pote |
last post by:
Hi All,
i have a datatable in which iam creating 2 datacolumns , one is SampleID and
second is TestType.
iam creating a datarow depending on a for loop, if the for loop goes 5 times
it will insert 5 records.
every thing works well, what i want is to delete the Duplicate Rows
|
by: Prince |
last post by:
Hi All,
Can anyone tell me how to Insert,Update and Delete a record into
already existing DataTable?
Looking forward for the reply...
Thanx in advance...
Regards,
| |
by: Sam |
last post by:
Hi,
As I loop through a dataview's records, I delete datarow based on a
condition. However I don't want to commit those deletions until the
loop ends. With a datatable, i would just set row.delete() and call
AcceptChanges when the loop ends. But how can I do that with a dataview
?
Thank you
|
by: Ryan Liu |
last post by:
Hi,
When my code run to
DataRow.Delete()
It throws:
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: length
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array
|
by: Pete Wittig |
last post by:
Hi,
I have a DataTable and I want to get a subset of the rows within it. I use
the Select method to get my subset and the results are in a DataRow. I
want to put those Rows back into a DataTable. I've tried a few variations of
the following but no rows are every imported into the datatable:
DataRow datrow = ds.Tables.Select("PersonID = " + id);
DataTable dt = new DataTable();
|
by: rn5a |
last post by:
The .NET 2.0 documentation states the following:
When using a DataSet or DataTable in conjunction with a DataAdapter & a
relational data source, use the Delete method of the DataRow to remove
the row. The Delete method marks the row as Deleted in the DataSet or
DataTable but does not remove it. Instead when the DataAdapter
encounters a row marked as Deleted, it executes its DeleteCommand
method to delete the row at the data source. The...
|
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...
|
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,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |