[dba-VB] VB.net data bound form problem

Paul Hartland paul.hartland at googlemail.com
Thu Mar 13 10:49:06 CDT 2014


Thanks for the replies, I must have had a blonde moment and done something
wrong, I get frustrated with my own developments and learning very easily,
so I ended up deleting everything, started a new project and it worked, no
idea what I done the first time round though, have joined a couple more
forums now as well, just need to learn what I done with wizards and
dragging in code now as I like coding everything myself where I can.

Thanks again ;)

Paul


On 13 March 2014 15:11, Salakhetdinov Shamil <mcp2004 at mail.ru> wrote:

>  Hi Paul --
>
> It should work.
> How have you "added a datasource and dataset"?
> It usually happens in reverse order:
>
> - 1st - a blank dataset is added;
> - 2nd - a data table is dragged from 'Server Explorer' window entry and
> dropped on dataset by thus creating a datasource...
>
> Of course there are many other variations...
>
> -- Shamil
>
> Wednesday, March 12, 2014 6:23 PM UTC from Paul Hartland <
> paul.hartland at googlemail.com>:
> >To all,
> >
> >Sorry to the Access group for the OT but I do not seem to be getting any
> >response from the visual basic list.  I am what I call a developer
> dinosaur
> >I know VBA and VB6, keep trying to learn VB.net and C#, but always get
> >sidetracked, however after going on a three day introduction course for
> >ASP.net MVC development using VB.net has got me interested again.  I have
> >SQL Server 2012 Express and Visual Studio 2012 Express installed, I
> created
> >a new blank database and as I am just messing about imported the Customers
> >table from the Northwind sample, I then opened a new Visual Basic project,
> >kept the form as Form1 and added a datasource and dataset
> >called TestDataSet, I then dragged the CustomerID field onto the form and
> >it appeared along with a binding navigator at the top of the form, without
> >me doing anything the code behind the form looks like this
> >
> >Public Class Form1
> >
> >    Private Sub CustomersBindingNavigatorSaveItem_Click(sender As Object,
> e
> >As EventArgs) Handles CustomersBindingNavigatorSaveItem.Click
> >        Me.Validate()
> >        Me.CustomersBindingSource.EndEdit()
> >        Me.TableAdapterManager.UpdateAll(Me.TestDataSet)
> >    End Sub
> >
> >    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
> >MyBase.Load
> >        'TODO: This line of code loads data into the
> >'TestDataSet.Customers' table. You can move, or remove it, as needed.
> >        Me.CustomersTableAdapter.Fill(Me.TestDataSet)
> >
> >    End Sub
> >End Class
> >
> >So I started up the application and could flick through all the ID's using
> >the navigation buttons, however if I try to change an ID then click the
> >save icon on the binding navigator I get the following error:
> >
> >An unhandled exception of type 'System.InvalidOperationException' occurred
> >in Northwind.exe
> >
> >Additional information: Update requires a valid UpdateCommand when passed
> >DataRow collection with modified rows.
> >
> >and the line of code Me.TableAdapterManager.UpdateAll(Me.TestDataSet) is
> >highlighted, I assumed that as the binding navigator was working the save
> >would too.
> >
> >Can anyone tell me what is wrong and/or point me in the right direction to
> >do this a better way.
> >
> >Many thanks in advance for any help on this.
> >
> >Kind Regards,
> >
> >Paul
> >
> >
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
>
>


-- 
Paul Hartland
paul.hartland at googlemail.com


More information about the dba-VB mailing list