HELP can only update one field at a time????

  • Thread starter Thread starter Aaron Ackerman
  • Start date Start date
A

Aaron Ackerman

I am at my wits end. I have tried everything. I have a WinForms N-Tier app
using VB.NET.
Visual DataAdapters, typed Datasets.

If I make change to one bound textbox no problem dataset gets updated and
change is made. If I change two or more fields NO changes get applied,
UNLESS I step through of course and then my two or more fields get updated
here is a code snippet

'I tried with and without this it doesn't seem to help
Me.txtHomePhone.DataBindings.Clear()
Me.txtWorkPhone.DataBindings.Clear()
Me.txtPostalCode.DataBindings.Clear()

'New field values get assigned
vdsClientUI.ClientByID.Rows(0).Item("PersonHomePhone") =
Me.txtHomePhone.Text
vdsClientUI.ClientByID.Rows(0).Item("PersonWorkPhone") =
Me.txtWorkPhone.Text
vdsClientUI.ClientByID.Rows(0).Item("PersonPostalCode") =
Me.txtPostalCode.Text

'passes dataset from the UI through the middle tier to the datalayer
objClient.UpdateClientByID(Me.vdsClientUI, "ClientByID")

'At the datalayer update gets applied
Public Overridable Function UpdateClientByID(ByRef vdsClient As
dsClient, ByRef TableName As String)
vdaClientByID.Update(vdsClient, TableName)
vdsClient.AcceptChanges()
End Function

'Stepping through does no good because all of the changes get applied, am I
missing a setting or a method call??
 
Remove AcceptChanges. It's called automatically ...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Nope it looks like I am still having problems


William (Bill) Vaughn said:
Remove AcceptChanges. It's called automatically ...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

am
 
Hello Aaraon

Looking at your code(with the exception of the AcceptChanges which bill
already pointed out as unneeded) everything looks like it should work.

I am doing very similar stuff using the SqlClient (are you doing SqlServer
or what?) the only difference is that I do not use databound text controls.
I load the controls manually, and I extract changes manually. No problems.

Don't know if this helps you except to say that I am not experienceing the
problem you are describing. Try manually populating and reading controls.
See if that changes the situation.
 
Hi Aaraon,

This issue is by design. You have to call EndEdit() method of the DataRow
after assigning value to fields.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "Aaron Ackerman" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: HELP can only update one field at a time????
| Date: Wed, 29 Oct 2003 19:55:08 -0500
| Lines: 68
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: ric-64-83-27-134-serial-sta.t1.cavtel.net 64.83.27.134
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:64861
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| THANKS, I don't get it why would that cause the problem???
|
|
| | > Remove AcceptChanges. It's called automatically ...
| >
| > --
| > ____________________________________
| > William (Bill) Vaughn
| > Author, Mentor, Consultant
| > MVP, hRD
| > www.betav.com
| > Please reply only to the newsgroup so that others can benefit.
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > __________________________________
| >
| > | > > I am at my wits end. I have tried everything. I have a WinForms N-Tier
| app
| > > using VB.NET.
| > > Visual DataAdapters, typed Datasets.
| > >
| > > If I make change to one bound textbox no problem dataset gets updated
| and
| > > change is made. If I change two or more fields NO changes get applied,
| > > UNLESS I step through of course and then my two or more fields get
| updated
| > > here is a code snippet
| > >
| > > 'I tried with and without this it doesn't seem to help
| > > Me.txtHomePhone.DataBindings.Clear()
| > > Me.txtWorkPhone.DataBindings.Clear()
| > > Me.txtPostalCode.DataBindings.Clear()
| > >
| > > 'New field values get assigned
| > > vdsClientUI.ClientByID.Rows(0).Item("PersonHomePhone") =
| > > Me.txtHomePhone.Text
| > > vdsClientUI.ClientByID.Rows(0).Item("PersonWorkPhone") =
| > > Me.txtWorkPhone.Text
| > > vdsClientUI.ClientByID.Rows(0).Item("PersonPostalCode") =
| > > Me.txtPostalCode.Text
| > >
| > > 'passes dataset from the UI through the middle tier to the datalayer
| > > objClient.UpdateClientByID(Me.vdsClientUI, "ClientByID")
| > >
| > > 'At the datalayer update gets applied
| > > Public Overridable Function UpdateClientByID(ByRef vdsClient As
| > > dsClient, ByRef TableName As String)
| > > vdaClientByID.Update(vdsClient, TableName)
| > > vdsClient.AcceptChanges()
| > > End Function
| > >
| > > 'Stepping through does no good because all of the changes get applied,
| am
| > I
| > > missing a setting or a method call??
| > >
| > >
| > >
| > >
| > >
| >
| >
|
|
|
 
Back
Top