473,811 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with DataGrid/DataSet add/update/delete functions

I will explain the problem that i have with as much detail as i can.
I have an application developed using C# & SQL 2000. I am using a relational
database scheme.
The problem is present in this part of the application:
I have two tables, "Providers" & "Providers_Tele phones", connected by a
relation:
1 Provider -> many Telephones.
I have created a DataSet that has the 2 tables and this relation defined.
I defined 1 Master DataGrid that contains all the Providers data and then a
Detail Datagrid connected by the relation that shows the Telephones of the
selected Provider.
I have created 4 Stored Procedures for each Table to do the following:
insert/mod/delete/select all.
Using 1 SQLDataAdapter for each table i fill the tables in the DataSet.
Up to here everything works as designed.
For testing purpose, i have manually added some Providers & Telephones.
When i want to mod a Telephone, i have no problems.
The problem appears when i want to add a new row, modify that new row and
delete a row. It looks like those changes NEVER took place in the DataSet, so
they are not updated in the Database.
I am using this for the "modificati on" operation:
this.dataSetPro viders.Tables["Providers_Tele phones"].RowChanged +=new
DataRowChangeEv entHandler(Prov idersTelephone_ RowChanged);
[...]
private void ProvidersTeleph one_RowChanged( object sender,
DataRowChangeEv entArgs e)
{
if (this.dataSetPr oviders.HasChan ges())
{
this.sqlDataAda pterTelephones. Update(this.dat aSetProviders.P roviders_Teleph ones);
}
}

It looks like i do not know when the event to add the new/delete a Row
happens, so i am not confirming that change on the DataSet, so that change
never goes to the Database.
Any help on this will be great.
Thanks for your time.
Nov 16 '05 #1
1 2343
Nobody has an idea about this?
I think the problem must be in the update of the DataGrid or the DataSet...
Nov 16 '05 #2

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

Similar topics

3
2233
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if he row.delete() in my Delete_Row sub is correct because when deleting a record from the dbase, it doesnot get deleted from the actual database, even tho on the datagrid it does show that the record is deleted: '''''''''''''
0
2744
by: Leona Smyth | last post by:
I am trying to update data directly in a datagrid using the UpdateCommand. However when I click the update button in my datagrid nothing seems to happen. I keep going round in circles and can't seem to work out whats wrong. I've included the html code and the info from the code behind page. Could someone please please help me work out where i;ve went wrong. HTML <asp:datagrid id="DataGrid2" style="Z-INDEX: 101; LEFT:
0
367
by: David | last post by:
Hello. I have some little problem with DataSet and I hope somebody will help me. So what's my problem: I have DataSet with some table in it lets say table name is "Suppliers", I have DataGrid to show the records from this DataSet and toolbar fornavigating and editing rows in DataSet. I'm using another form for editing data and the manualy update it to DataSet.
9
1646
by: Pam Ammond | last post by:
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow deleting a Size using a datagrid, and then return to frmSize and want to update the datagrid in frmSize to reflect the deletion. I can't figure out how to get the datagrid in frmSize updated, although the datagrid in frmSizeDelete shows the deletion properly. In frmSizeDelete the size is properly deleted when the user clicks the row in the datagrid and presses...
1
3786
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a Yes/No value in Access. Using the OleDbCommand, if I do not consider the Yes/No field, the ExecuteNonQuery command, using my UPDATE SQL statement, updates the record correctly. However, if I put the Yes/No field into the mix, ExecuteNonQuery...
1
1542
by: jason | last post by:
The guts of the below asp.net vb code was pieced together from another thread - all due credit to it's original author. Thank you! I've modified it to maintain a small local Microsoft 2000 access DB via a datagrid control. The add and delete functions work great, but the edit does not actually update the database. I put in some displays and apparently on the first item in the grid gets set during editing, all others come back empty???
5
1513
by: Maria Anthonsen | last post by:
I have filled a datagrid with data from a dataset. The dataset was filled with a dataadapter - and I used the wizard to create insert, update, delete commands. I would like to prevent the user from adding a new record in the datagrid, but still be able to change/delete data - is this possible?? Maria
9
2734
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then FillDataGrid()
1
1598
by: Andrew Wan | last post by:
Is it possible to make some of the DataGrid functionality to client-side? Such as the Edit, Update, Cancel, Delete functionality? Everytime I click on a row's Edit button, I wait 2 seconds before I see the Edit controls (eg. textboxes, drop-down combos, checkboxes). I understand that the DataGrid's Edit, Cancel, Update, Delete functions are server-side because it uses ASP.NET postback handler functions.
0
9730
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
10651
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
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 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...
1
10403
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,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
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
6893
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4341
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 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.