473,769 Members | 4,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dataset not getting data of the the datagrid

hi,
let:

dataSet1 is having some data from database.

dataView1 = dataSet1.table( 0).defaultView
dataGrid1.dataS ource = dataView1
[.. programatically construct a tablestyle for the grid ..]
dataGrid1.Table Style.add(myTab leStyle1)

ok, now i show the datagrid on a form. the use left clicks on a cell,
changes a value, and WITHOUT CLICKING ON ANY OTHER CELL OF THE
DATAGRID,
clicks a button on the same form.

on button click, i do:

if dataSet1.HasCha nges(DataRowSta te.Modified) then
dataSet2 = dataSet1.GetCha nges(DataRowSta te.Modified)
end if

the problem is that dataSet2 has a table with one row, the row which
the use had clicked, BUT WITHOUT THE CHANGED DATA. it contains the
same old data with wich the grid was loaded initially.

is there any way out of this problem ? i need the changed data.
i have tried dataGrid1.refre sh et.al....

saha
--
Nov 20 '05 #1
3 1798
Cor
Hi Anand,

I think you do a lot more than needed, but start with to try this before
that haschanges.

BindingContext( dataset1.tables (0)).EndCurrent Edit()

I hope this was the solution?

Cor
Nov 20 '05 #2
First question, if you re-connect to the database are the changes your user
makes, actually being written back to the database? If not, then that is
the reasons your changes are not showing up. I ran into the same problem
with an Access Database and got so frustrated that what I finally did (which
is not the "proper" way to do it) was to just re-connect to the database
AFTER deleting the current row that was being edited and adding it back to
the database as a NEW datarow. A very ugly work-around, but it works. I am
currently in the proccess of fixing that as that is not the way it is
supposed to work.
If you are using a DataAdaptor to get to your database, be sure you are
refreshing it too.
james

(I'm almost ashamed to post this, but, I understand the frustration of
working with Access Databases in VB.NET)

"anand" <an*******@redi ffmail.com> wrote in message
news:f7******** *************** ***@posting.goo gle.com...
hi,
let:

dataSet1 is having some data from database.

dataView1 = dataSet1.table( 0).defaultView
dataGrid1.dataS ource = dataView1
[.. programatically construct a tablestyle for the grid ..]
dataGrid1.Table Style.add(myTab leStyle1)

ok, now i show the datagrid on a form. the use left clicks on a cell,
changes a value, and WITHOUT CLICKING ON ANY OTHER CELL OF THE
DATAGRID,
clicks a button on the same form.

on button click, i do:

if dataSet1.HasCha nges(DataRowSta te.Modified) then
dataSet2 = dataSet1.GetCha nges(DataRowSta te.Modified)
end if

the problem is that dataSet2 has a table with one row, the row which
the use had clicked, BUT WITHOUT THE CHANGED DATA. it contains the
same old data with wich the grid was loaded initially.

is there any way out of this problem ? i need the changed data.
i have tried dataGrid1.refre sh et.al....

saha
--

Nov 20 '05 #3
"Cor" <no*@non.com> wrote in message news:<eG******* ******@tk2msftn gp13.phx.gbl>.. .
Hi Anand,

I think you do a lot more than needed, but start with to try this before
that haschanges.

BindingContext( dataset1.tables (0)).EndCurrent Edit()

I hope this was the solution?

Cor


hi Cor,

i could solve it this way. before doing a dataset1.hascha nge, i did:

For Each cs As DataGridColumnS tyle In
dataGrid1.Table Styles(0).GridC olumnStyles

dataGrid1.Table Styles(0).EndEd it(cs,
datagrid1.Curre ntCell.RowNumbe r, False)

Next

then after doing a dataset1.hascha nge and before dataset1.getcha nge, i
did:

Dim rowIndex As Integer
rowIndex = baseDataGrid.Cu rrentRowIndex
dataGrid1.Curre ntRowIndex = 0
dataGrid1.Curre ntRowIndex = rowIndex

dataSet3 = dataSet1.GetCha nges(DataRowSta te.Modified)
it worked! the trick is, i think, that the changes appeared in
dataSet3 after i changed(shuffle d) the row index of the datagrid.
thanks for the hint.

saha
--
Nov 20 '05 #4

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

Similar topics

1
1488
by: John Scott | last post by:
I was just wondering if it's possible to cast a datagrid DataSource as a DataSet? I've stepped through my code when the grid is first being bound and the DataSource shows up as a DataSet for the datagrid. Then, when I handle on OnClick event for an image button and the page posts back, I look at the DataSource for the grid and it says it's null. Is there any way of getting the grid's current datasource after it loads? I've tried...
4
2847
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
0
3504
by: Dave | last post by:
Tried posting in the Winform Forum without much luck, so posting here... After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is after the newly added row without getting bizarre results. I have added the full code for the test below. Create a project drop in the code and run. There is nothing crazy about the code. I used the designer to add the dataset and to do the...
2
4828
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different row selected in the datagrid. I want to save the changes that user make in the textboxes when they select a different row in the datagrid. I tried capturing the textbox.text at datagrid's CurrentCellChanged event but by then the textbox.text...
3
2055
by: Ben Becker | last post by:
I am trying to build a custom crosstab type of grid where I take some items in a data grid and based on the content of the current item compared to the previous item, determine if a new row in a table should be created or not. In order to do this, I need to have full control over the conditional logic for how items get displayed within a repeater element which I'm not seeing as possible. How can I cursor through a data set, apply...
2
1430
by: Steve | last post by:
I would not have thought that getting a DataGrid connected to a DataSet (read in from an XML file) would be this complicated. I cannot get this to work. I have read everything I could find and modeled all the examples given but this grid just refuses to behave nicely. The code is listed below as well as the XML schema and XML data. The connection between the data set and grid seems to work just fine. What won't work is the display...
4
3754
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure and username, password etc will be exactly the same for each server, the only thing that will change is the server name. Idealy I would like to get the server names from a seperate dataset so there could be any number of servers, allthough in...
17
2770
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1 first, and the mydataset1 data source was getting from DataGrid.DataSource.
2
2596
by: Carl Heller | last post by:
Working in VS2003, .Net 1.1 I'm working on a project where I compare data between two databases. This is a lengthy process, and very data intensive, so I decided to create a class, and thread out the work. The order of work is as follows: 1. Retrieve the data from primary data source 2. Update UI with retrieved data - this is accomplished by passing a dataset as an event parameter
4
2313
by: Soulless | last post by:
Hi, is there any way to copy a dataset to a datagrid? I have a dataset and want to copy to a datagridview, but I get no results.... thx!
0
10043
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
9990
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
8869
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
7406
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
6672
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();...
0
5298
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
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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.