•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 426,593 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,656 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 332 | Replies: 3 | Solved
![]() |
•
•
Join Date: Jun 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hello everyone,
as will be seen from the following massage I am new to C#.
I have dataGrid that reads data from mine database. Also, I can update database from dataGrid, but I want to update it in more ways. So, I have the following code just to see something, but to mine big surprise it does not give me the results that I expect:
dataSet1.Tables["Example"].Rows[i].ItemArray[j]=33 ;
MessageBox.Show(dataSet1.Tables["Example"].Rows[i] .ItemArray[j].ToString());
MessageBox shows me the old value (the value is not changed). Why is that?
Thanks in advance.
as will be seen from the following massage I am new to C#.
I have dataGrid that reads data from mine database. Also, I can update database from dataGrid, but I want to update it in more ways. So, I have the following code just to see something, but to mine big surprise it does not give me the results that I expect:
dataSet1.Tables["Example"].Rows[i].ItemArray[j]=33 ;
MessageBox.Show(dataSet1.Tables["Example"].Rows[i] .ItemArray[j].ToString());
MessageBox shows me the old value (the value is not changed). Why is that?
Thanks in advance.
Did you commit the changes done at the dataset?!
B.Sc Computer Science, Helwan University
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
•
•
Join Date: Jun 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Yes, I have tried it (it was also mine first guess), but with no results. I am doing something wrong, but don’t know what.
The row remains unchanged. For example the following code would give me message: “unchanged”
dataSet1.Tables["Example"].Rows[i].ItemArray[j]=33;
MessageBox.Show(dataSet1.Tables["Example"].Rows[i].RowState.ToString());
In despair I have tried all the combinations (before and after the line where I have tried to assign new value to the row):
dataSet1.AcceptChanges();
dataSet1.Tables["Example"].AcceptChanges()
dataSet1.Tables["Example"].Rows[i].AcceptChanges()
The result is always the same – I can’t change anything, and I remind you that when I try the same thing with DataGrid it works just fine.
Mine next guess was that DataGrid locks in some way Dataset (stupid guess, but I was desperate) and I’ve tried the whole thing without Dataset, but with no results again.
Mine guess is that I am not committing changes in a Dataset the way I should, but I can’t find a mistake.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: datagridview codes
- Next Thread: Need help on saving hole form and content


Linear Mode