Dataset Problem

  • Thread starter Thread starter asad.naeem
  • Start date Start date
A

asad.naeem

I have bound all the controls with a typed dataset, Data are retrieved
into the controls correctly. when i change the data in the control its
state did not change. It should be changed from Unchanged state to
Modified state. But it is not working.


Regards and Thanks in Advance
Asad
 
Just out of curiosity, are you checking to see if the data is changed
before the user goes to another row? I posted a similar question here
not long ago. My problem boiled down to .NET doesn't seem to see the
changes to a field in a dataset bound to a datagrid until after the
user moves off the row. As the user moves across a row, .NET thought
the data was unchanged, even though I had modified data.

I ended up keeping a set of form level variables to track the value of
the cells. I set the values when the user changes to a new row and
then compare the values with the respective columns in the dataset if
the user hasn't moved to a different row. It wasn't a whole lot of
code, but it seemed rather kludgy to me. Oh well, it worked!
 
i am talking about the datagrid, i am talkingabout the controls such as
textboxes. If the problem remains same what should i do?

Asad
 
sorry i was not talking about the datagrid.i am talkingabout the
controls such as
textboxes. If the problem remains same what should i do?

Asad
 
i have a typed dataset. I have a tableA in it. there are 4 columns of
this tabeA ie, ColA, ColB, ColC, ColD.
I have four text boxes named textboxA, textboxB, textboxC, textboxD on
my form. I have bound each textbox with each column. When i retrieve
data it is OK. When i change any data in the textbox. Amazingly changed
data are reflected in the dataset column. But it state is not set to
Modified. Is there any possibility that my typed dataset is corrupted
or damaged. Or its some necessary file is missing which works for the
tables updations.

Regards
Asad Naeem
 
This is consistent with the behavior I have seen in .NET. My solution
would be to add 4 new form level variables.

Public storedValueA as String .....

Each time the user moves to a new row in the datagrid, set their value
to the corresponding value in the dataset:

storedValueA = dataset.tables(0).row(currentrow).item("ItemA")

Each time the user changes to a different cell in the same row, check
to see if they changed any data:

If dataset.tables(0).row(currentrow).item("ItemA") <> storedValueA
...
EndIf

Just so you know, My base form class has currentrow and currentcolumn
variable that is updated with each datagrid cell change just for things
like this.

Hope this helps.
 
Asad,

Often is this because people are using the acceptchanges wrong. Do you use
the acceptchanges?

Cor
 
Sir many many thanks for ur great help. But Sir I am not using
Datagrid. I am using only textboxes on my form. So plz guide me in this
sscenario.

Regards
Asad Naeem
 
Asad,

Now I see that I thought that the data was already in the dataset fields but
you wrote in the controls.

The normal command for this is in 1.x the
Currencymamager(TheUsedDataSource)endcurrentedit. In 2.0 when you use the
bindingsource than it is the endedit.

Maybe to late but to let you know.

Cor
 
Back
Top