Any idea why my BindingSource won't update?



I have the following:

1 x .NET 2.0 .DLL

Containing one public DataSet (CustomerHandler) which contains one table and
a tableadapter to fill a datatable

1 x .NET 2.0 EXE

With a single form containing a DataSet (CustomerHandler1), a BindingSource
and a BindingNavigator. And also a whole load of textbox controls which are
databound to the BindingSource.

1 x SQL Server Express database


The problem is this:

When I enter the form, it reads the data perfectly and I can move from
record to record vis the BindingNavigator, and even add, delete and update
records. However, these changes are not being carried through to the
database - I ran SQL Server Profiler on the database and nothing was
happening at any stage, not even when the .EndEdit() method was called. I am
assuming that because I have a DataSet (CustomerHandler1) on my form, that
it is this that is being changed, and not the dataset in the satellite

I want all my data in the satellite assembly as this is my data access layer

The code is as follows (CustomerHandler is the name of my dataset as defined
in the satellite assembly):

Dim CustomerHandlerTA As New


CustomerHandlerTA = New CustomerHandlerTableAdapters.II_CUSTOMERTableAdapter


Catch ex As Exception



CustomerHandlerTA = Nothing

End Try

Private Sub SaveChanges_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SaveChanges.Click


End Sub


It all works perfectly in read-only mode and the dataset can be edited in
memory, but why aren't changes being propogated through to the database?

Any suggestions very warmly welcome!



"Mike" <none> wrote in message
Ok, I've fixed it - but my fix is just a hack. Basically, I can't call a
tableadapter update and pass in a dataset - I have to explicitally pass in a
datatable - this works. I can't access the TableAdapter that I create below
because it's out of scope in the SaveChanges_Click(..) function. So... I
moved the CustomerHandlerTA declaration and made it a friend variable at the
top of the module. Messy, is there a better way?

I also changed the SaveChanges_Click() such that I now call:

Again, messy. I'd rather call the BindingSource.EndEdit() method. Why
doesn't this method simply work on its own?


My next problem is I need to add more datatables to the dataset. How can I
go about updating an entire dataset in one go? One would have thought the
..EndEdit() method called on a BindingSource bound to a DataSet would work

If I create a DataTable which contained a SQL set of data from across
multiple tables, could I still insert new rows in this way? One would think
not, as the META-data describing the relationships between the various
original tables will have been lost in translation.

Thanks in advance for any advice!

Warm Regards,


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question