473,320 Members | 1,876 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,320 software developers and data experts.

Bound controls do not copy across data to underlying data row

Hi

I have a small app with bound controls that do not seem to be copying across
the data entered into them to the underlying row for the update. This one
really has me stump even though these are very simple steps and I can't see
where I am going wrong. Any help would be appreciated.

The relevant code goes as follows;

Binding controls

Dim db As System.Windows.Forms.Binding
ds = MyDataset
db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
txtID.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
txtCompany.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
txtAddress.DataBindings.Add(db)

bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)

Adding a new record;

ds.Clients.Clear()
bmCompanyDetails.AddNew()

Some data is entered in the Company and Address bound fields by user and
Save button is pressed to save as below;

Focus()
bmCompanyDetails.EndCurrentEdit()
Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row

If (Row.RowState = DataRowState.Added) Then
' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data is
stored in datatable so update is working
daCompanies.Update(ds.Clients)
End If

The Clients table is an MS Access table with ID set to Random Auto number.

Thanks

Regards
Feb 10 '08 #1
2 1184
So if I understand correctly, the data will update in the underlying row if
you uncomment that line of code out. If you use yourDataSet.HasChanges(),
what does it return (putting it right before the Update call?). Is it that
when you call Update, it doesn't get sent to the DB?

--
bill.ryan | technology.evangelist | magenic.technologies
mvp - device application development
http://www.msmvps.com/WilliamRyan
http://www.magenic.com
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:Oe**************@TK2MSFTNGP05.phx.gbl...
Hi

I have a small app with bound controls that do not seem to be copying
across the data entered into them to the underlying row for the update.
This one really has me stump even though these are very simple steps and I
can't see where I am going wrong. Any help would be appreciated.

The relevant code goes as follows;

Binding controls

Dim db As System.Windows.Forms.Binding
ds = MyDataset
db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
txtID.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
txtCompany.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
txtAddress.DataBindings.Add(db)

bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)

Adding a new record;

ds.Clients.Clear()
bmCompanyDetails.AddNew()

Some data is entered in the Company and Address bound fields by user and
Save button is pressed to save as below;

Focus()
bmCompanyDetails.EndCurrentEdit()
Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row

If (Row.RowState = DataRowState.Added) Then
' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data is
stored in datatable so update is working
daCompanies.Update(ds.Clients)
End If

The Clients table is an MS Access table with ID set to Random Auto number.

Thanks

Regards

Feb 11 '08 #2
Ryan, it was a binding issue which Miha has kindly solved for me in another
thread.

Many Thanks

Regards

"W.G. Ryan" <Wi*********@nospam.gmail.comwrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
So if I understand correctly, the data will update in the underlying row
if you uncomment that line of code out. If you use
yourDataSet.HasChanges(), what does it return (putting it right before the
Update call?). Is it that when you call Update, it doesn't get sent to
the DB?

--
bill.ryan | technology.evangelist | magenic.technologies
mvp - device application development
http://www.msmvps.com/WilliamRyan
http://www.magenic.com
"John" <Jo**@nospam.infovis.co.ukwrote in message
news:Oe**************@TK2MSFTNGP05.phx.gbl...
>Hi

I have a small app with bound controls that do not seem to be copying
across the data entered into them to the underlying row for the update.
This one really has me stump even though these are very simple steps and
I can't see where I am going wrong. Any help would be appreciated.

The relevant code goes as follows;

Binding controls

Dim db As System.Windows.Forms.Binding
ds = MyDataset
db = New System.Windows.Forms.Binding("Text", ds.Clients, "ID")
txtID.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Company")
txtCompany.DataBindings.Add(db)
db = New System.Windows.Forms.Binding("Text", ds.Clients, "Address")
txtAddress.DataBindings.Add(db)

bmCompanyDetails = CType(BindingContext(ds, "Clients"), CurrencyManager)

Adding a new record;

ds.Clients.Clear()
bmCompanyDetails.AddNew()

Some data is entered in the Company and Address bound fields by user and
Save button is pressed to save as below;

Focus()
bmCompanyDetails.EndCurrentEdit()
Row = DirectCast(bmCompanyDetails.Current, DataRowView).Row

If (Row.RowState = DataRowState.Added) Then
' Row.Item(5) = "Test column 5" ' if this line is un-remmed this data
is stored in datatable so update is working
daCompanies.Update(ds.Clients)
End If

The Clients table is an MS Access table with ID set to Random Auto
number.

Thanks

Regards


Feb 11 '08 #3

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

Similar topics

3
by: PAUL EDWARDS | last post by:
I have a windows form that is bound to a datatable. In VB6 I could just update the field contents and it would be updated in the database, however if I update the text property of the control from...
42
by: Edward Diener | last post by:
Coming from the C++ world I can not understand the reason why copy constructors are not used in the .NET framework. A copy constructor creates an object from a copy of another object of the same...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
4
by: kaborka | last post by:
I have a WinForm with controls bound to a typed recordset that was generated by the Dataset Designer. There are several ComboBox controls with their DataSource bound to different lookup tables. ...
7
by: vsiat | last post by:
I am trying to create a treeview out of a database table with the typical structure ID, NAME, PARENTID, TYPE, EXTRA_INFO, where is linked to the . What I want to achieve is create a tree made...
4
by: Lenster | last post by:
Hi I'm using bound controls on a windows form such as textboxes, checkboxes etc. which work fine except for one thing... If you click on a checkbox for example its value changes visibly and...
8
by: Jon Weston | last post by:
I'm setting up an Access2003 database with pictures. I put a bound ole picture ctrl on a form that's source is the table that contains the pictures and follow ALL the directions for embedding a...
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
2
by: cjard | last post by:
Suppose: A TextBox is bound to a BindingSource, which is bound to a DataTable A BindingNavigator is used to alter the current row being looked at by the BindingSource (i.e. Nav's NEXT button is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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: 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...

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.