473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

dataset not getting data of the the datagrid

hi,
let:

dataSet1 is having some data from database.

dataView1 = dataSet1.table(0).defaultView
dataGrid1.dataSource = dataView1
[.. programatically construct a tablestyle for the grid ..]
dataGrid1.TableStyle.add(myTableStyle1)

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.HasChanges(DataRowState.Modified) then
dataSet2 = dataSet1.GetChanges(DataRowState.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.refresh et.al....

saha
--
Nov 20 '05 #1
3 1781
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)).EndCurrentEdit( )

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*******@rediffmail.com> wrote in message
news:f7**************************@posting.google.c om...
hi,
let:

dataSet1 is having some data from database.

dataView1 = dataSet1.table(0).defaultView
dataGrid1.dataSource = dataView1
[.. programatically construct a tablestyle for the grid ..]
dataGrid1.TableStyle.add(myTableStyle1)

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.HasChanges(DataRowState.Modified) then
dataSet2 = dataSet1.GetChanges(DataRowState.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.refresh et.al....

saha
--

Nov 20 '05 #3
"Cor" <no*@non.com> wrote in message news:<eG*************@tk2msftngp13.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)).EndCurrentEdit( )

I hope this was the solution?

Cor


hi Cor,

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

For Each cs As DataGridColumnStyle In
dataGrid1.TableStyles(0).GridColumnStyles

dataGrid1.TableStyles(0).EndEdit(cs,
datagrid1.CurrentCell.RowNumber, False)

Next

then after doing a dataset1.haschange and before dataset1.getchange, i
did:

Dim rowIndex As Integer
rowIndex = baseDataGrid.CurrentRowIndex
dataGrid1.CurrentRowIndex = 0
dataGrid1.CurrentRowIndex = rowIndex

dataSet3 = dataSet1.GetChanges(DataRowState.Modified)
it worked! the trick is, i think, that the changes appeared in
dataSet3 after i changed(shuffled) 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
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...
4
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
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...
2
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...
3
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...
2
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...
4
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...
17
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...
2
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...
4
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.