I'm experiencing a strange Dataset Update problem with my application.
I have a dataset which has a table holding a set of customer information
records. (address, contact, info, etc.)
I have a series of ComboBoxes (Client Number for selection), and text fields
to show the other data bound to this Dataset.table
If I change a value for the first client in the list, and press my update
client button, the data is successfully updated to the database.
If I change a value for another client (email address, for instance), the
value is not saved back to the database.
In both instances, HasChanges will report true. In the first instance
(changing the first client in the list), the DebugXML shows the row with the
new value.
In the second instance (another client), it shows both the first row, and
the second row (not the row that has actually changed), but neither shows
any changed values, they are all unchanged.
I have included the Subroutine that handles the Update Button click event,
which does the Dataset Update.
The DataAdapter is filled through a stored procedure, and the update command
is also a stored procedure. All parameters are set to the correct source
columns.
This just has me totally baffled, and I hope someone can help me understand
this problem.
Thanks, Kevin
Private Sub btnUpdateClient _Click(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnUpdateClient .Click
Me.connExpress. Open() 'Open the connection
Try
Me.BindingConte xt(Me.DsCustome rInfo1.CW_custo merinfo).EndCur rentEdit()
MsgBox("Has Changes: " & Me.DsCustomerIn fo1.HasChanges. ToString)
If Me.DsCustomerIn fo1.HasChanges Then
Me.DsCustomerIn fo1.GetChanges. WriteXml("c:\te st\debug.xml")
End If
Me.daCustomerIn fo.Update(Me.Ds CustomerInfo1, "CW_customerinf o")
PopulateLicence Info()
ClientInfoUpdat ed = False
ClientInfoUpdat e()
Main.AddEventLo g(appPermission s.UserID, appSettings.Dis tributorID,
"6", Me.cmbClientNum ber.Tag, "Update Client Data", "",
Me.cmbClientNum ber.Text, "", "", "", "")
Me.errUpdatePen ding.SetError(M e.btnUpdateClie nt, "")
Me.DsCustomerIn fo1.AcceptChang es()
Catch ex As Exception
MsgBox(ex.ToStr ing & vbCrLf & vbCrLf & ex.Source.ToStr ing & vbCrLf &
vbCrLf & ex.StackTrace.T oString, MsgBoxStyle.Cri tical, "SQL Error")
Me.DsCustomerIn fo1.RejectChang es()
End Try
Me.connExpress. Close() 'Close the connection
End Sub 9 1548
Kevin,
In 80% when this problem is showed is this the solution.
Before the update (or check for changes)
BindingContext( ds.Tables(0)).E ndCurrentEdit()
Data is pushed in the datatables after a rowchange (or after this command)
I hope this helps?
Cor
Thanks Cor, but I do an EndCurrentEdit already, and check for HasChanges.
If it's the first row, everything works as expected, if it's any other row,
it goes haywire and doesn't work correctly.
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Kevin,
In 80% when this problem is showed is this the solution.
Before the update (or check for changes) BindingContext( ds.Tables(0)).E ndCurrentEdit()
Data is pushed in the datatables after a rowchange (or after this command)
I hope this helps?
Cor
Kevin,
Sorry, I should have seen it. I have been strugled long time myself using a
combobox with a binded textbox.
I have given it up. It is the most buggy control there is in my (and
probably Herfrieds) opinion.
When you can avoid them it is a great control by the way.
I have seen the most strange behaviour with that binded combobox, sent some
samples too this newsgroup and the newsgroup vb.controls. However, never got
one reaction. (Just because nobody knows the answers).
Sorry,
However maybe we see here a solution what is good for me as well.
Cor
Yes, I've been having problems with databound ComboBoxes and the Tag
Property not changing to the new selected value until after all events have
been comitted (there doesn't seem to be a way from any ComboBox change event
to get the bound tag value of the new selected item, I always get the tag
value for the previous item). I'm not sure if I'm explaining that well.
For instance, if I have my value member bound to a Client Number, and the
Tag bound to the the Primary Key column (UniqueID), during the change
events, the SelectedValue and Tag are pointing to two different records (The
SelectedValue points to the new row, the tag points to the previously
selected row). After all change events have completed however, the Tag
contains the correct value for the newly selected record.
This is causing me other problems, but I don't think it has a bearing on
this one (at least I hope it doesn't)
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:ub******** ******@TK2MSFTN GP09.phx.gbl... Kevin,
Sorry, I should have seen it. I have been strugled long time myself using
a combobox with a binded textbox.
I have given it up. It is the most buggy control there is in my (and probably Herfrieds) opinion. When you can avoid them it is a great control by the way.
I have seen the most strange behaviour with that binded combobox, sent
some samples too this newsgroup and the newsgroup vb.controls. However, never
got one reaction. (Just because nobody knows the answers).
Sorry,
However maybe we see here a solution what is good for me as well.
Cor
Hi Cor,
This has gotten even stranger.
Ok, so for an update. If I cycle through more than one client, each client I
"leave" ends up having it's HasChanges property set to true. I suspect this
is due to bound text fields that in the DB are NULL, but since they are
bound to blank TXT Fields, it's getting changed to "" or Nothing, not
DBNull.Value.
Anyway, unless I leave the Client (row), the one I Just changed won't be
updated. However, if I DO leave the Row, my changes will be updated.
I'm at a loss why it works correctly for the first row however. Is there
another Event called when the row is changed by selecting an item in the
ComboBox that I might be missing? All of these controls had their
Databinding set at Design Time.
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:ub******** ******@TK2MSFTN GP09.phx.gbl... Kevin,
Sorry, I should have seen it. I have been strugled long time myself using
a combobox with a binded textbox.
I have given it up. It is the most buggy control there is in my (and probably Herfrieds) opinion. When you can avoid them it is a great control by the way.
I have seen the most strange behaviour with that binded combobox, sent
some samples too this newsgroup and the newsgroup vb.controls. However, never
got one reaction. (Just because nobody knows the answers).
Sorry,
However maybe we see here a solution what is good for me as well.
Cor
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Kevin,
In 80% when this problem is showed is this the solution.
Before the update (or check for changes) BindingContext( ds.Tables(0)).E ndCurrentEdit()
Data is pushed in the datatables after a rowchange (or after this command)
I hope this helps?
Cor
What's the difference between: BindingContext( ds.Tables(0)).E ndCurrentEdit()
and (CurrencyManage r).EndCurrentEd it(),
and when do one over the other...
Thanks....
Bruce
Bruce it is the same, only not instanced that currencymanager
I have solved this problem, though I'm not pleased with how I have to do it.
I am save the currently selected index of the selection combobox, and then
set the selectedindex to -1, and then restore it to the saved selection.
This triggers the Row Change or whatever event is supposed to happen, in the
background, which sets the HasChanges flag correctly. Now all of my updates
are correctly saved. I just need to update my code to pop up the alerter
when actual changes have been made.
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:ub******** ******@TK2MSFTN GP09.phx.gbl... Kevin,
Sorry, I should have seen it. I have been strugled long time myself using
a combobox with a binded textbox.
I have given it up. It is the most buggy control there is in my (and probably Herfrieds) opinion. When you can avoid them it is a great control by the way.
I have seen the most strange behaviour with that binded combobox, sent
some samples too this newsgroup and the newsgroup vb.controls. However, never
got one reaction. (Just because nobody knows the answers).
Sorry,
However maybe we see here a solution what is good for me as well.
Cor
Kevin,
Thanks for letting us know, I stepped out of this one, because I had had
myself to much problems with bounded comboboxes (when not used as
dropdownlist because than I have never a problem).
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christian Hubinger |
last post by:
Hi!
I've implemented some DropDown list in ASP.NET that use Ajax to fetch
the data from the server. The javascript is written to call cascading to
the bottom most dropdown in order to update them all if a top one changed.
The strange thing is that the script runs without problems on IE but in
FireFox i get a "too much recursion" error and nothing happens.
Here is the javascript code generated:
|
by: Niyazi |
last post by:
Hi,
I have not understand the problem. Before all the coding with few
application everything worked perfectly. Now I am developing Cheque Writing
application and when the cheque is clear the user have to open a form and
entera date so we know in report that the desiered check has been cleared. It
takes me while to wrtie.
But when I try to update the datagrid changes via dataset to MS Access 2003
I get an error that simply says...
|
by: Lars Netzel |
last post by:
A little background:
I use three Datagrids that are in a child parent relation.
I Use Negative Autoincrement on the the DataTables and that's workning nice.
My problem is when I Update these grid and write to the database and I set
the new Primary Keys and related Fields to the new asigned atuonumbers in
the Access.
|
by: John |
last post by:
Hi
I have a perfectly working vs 2003 winform data app. All the data access
code has been generated using the data adapter wizard and then pasted into
the app.
I had to add a new field in the backend access db which I did. I then
dragged the table to the dataset and deleted the old table from the dataset
it so the dataset can see the new field as well.
|
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...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |
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: 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...
| |