I have the following:
1 x .NET 2.0 .DLL
Containing one public DataSet (CustomerHandle r) which contains one table and
a tableadapter to fill a datatable
1 x .NET 2.0 EXE
With a single form containing a DataSet (CustomerHandle r1), a BindingSource
and a BindingNavigato r. 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 BindingNavigato r, 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 (CustomerHandle r1) on my form, that
it is this that is being changed, and not the dataset in the satellite
assembly.
I want all my data in the satellite assembly as this is my data access layer
(DAL).
The code is as follows (CustomerHandle r is the name of my dataset as defined
in the satellite assembly):
Dim CustomerHandler TA As New
CustomerHandler TableAdapters.I I_CUSTOMERTable Adapter
Try
CustomerHandler TA = New CustomerHandler TableAdapters.I I_CUSTOMERTable Adapter
CustomerHandler TA.Fill(Custome rHandler1.II_CU STOMER)
Catch ex As Exception
MsgBox(ex.Messa ge)
Finally
CustomerHandler TA = Nothing
End Try
Private Sub SaveChanges_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles SaveChanges.Cli ck
BindingSource.E ndEdit()
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 1 8666
"Mike" <none> wrote in message news:eQ******** ******@TK2MSFTN GP11.phx.gbl...
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_Cli ck(..) function. So... I
moved the CustomerHandler TA declaration and made it a friend variable at the
top of the module. Messy, is there a better way?
I also changed the SaveChanges_Cli ck() such that I now call:
CustomerHandler TA.Update(Custo merHandler1.II_ CUSTOMER)
Again, messy. I'd rather call the BindingSource.E ndEdit() 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
fine.
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,
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Geoff |
last post by:
Hi folks
Calling BindingSource.ResetCurrentItem() is changing the
BindingSource.Position in a way I don't understand.
If I'm understanding the docs correctly, ResetCurrentItem()
should simply trigger an event which causes controls to
refresh with the values of the current item with the index
BindingSource.Position. This is not what I'm seeing.
|
by: dev |
last post by:
Hi Everyone, I'm a little confused with the .NET 2.0 BindingSource for
WinForms. Is it possible to update, insert or delete database items
through the BindingSource with a Typed data object as its DataSource?
Maybe something similar to the new databinding features of ASP .NET,
where you specify your methods and parameters, then call the Update()
method of your ObjectDataSource. I may be completely missing something,
just let me know. TIA...
|
by: Rob Dob |
last post by:
Hi,
I have both a Customer and a Orders Table, the key field is CustomerID. I
also have a DataGrid that uses a BindingSource which uses a dataset which
uses a join between the Customers table and the Orders table. Everything
displays correctly and when I double click on a row within the datagrid I
then open up a tabbed form that contains a detailed view of the record
selected. The user at this point is able to make changes to the...
|
by: Rob Dob |
last post by:
Hi,
I have both a Customer and a Orders Table, the key field is CustomerID. I
also have a DataGridView that uses a BindingSource created using a join
between the Customers table and the Orders table. Everything displays
correctly and when I double click on a row within the datagrid I then open
up a tabbed form that contains a detailed view of the bindingsource record
selected ( which was created using a join ). The user at this point...
|
by: Randy |
last post by:
Hi,
I'm have a form with a listbox and a few textboxes on it. Based on
the user's selection in the listbox, I want the bindingsource to
update the textboxes with the corresponding values. I have similar
code built for a combobox that works just fine, but when applying it
to a listbox bound to a dataview, I can't figure out how to return the
correct bindingsource index. No matter what item I select, my index
returns 0.
Private Sub...
| |
by: Mike |
last post by:
i have a small difficulties with BindingSource and dataGridView bind
db has properly opened and bind doesn't works. Unfortunately I didn't
find any good example how to connect MS Access with dataGridView and
BindSource class.
Maybe something like this:
DataTable dtResult = new DataTable();
dtResult = GetData(); // this line returns a error GetData
doesn't exists!
|
by: nev |
last post by:
I'm trying to learn how to save changes in my BindingSource. What is Me.Validate()? And do I need it everytime I do save the bindingsource?
Is this correct?
me.validate() '<-- What is this for?
bs.endedit()
if not me.adapter.update(datatable) > 0 then
msgbox("no records updated.") '<-- When does it not update?
end if
|
by: Daniel Jeffrey |
last post by:
..Net 2.0
VStudio 2005
C#
I know this is going to seem like a strange question, as even I am sure I
have missed something - but I cant find it.
I want a simple event on any of the objects (BindingSource, DataSet,
DataTable) that fires when data in a bound control changes.
|
by: Sepidar |
last post by:
hi,
I have a DataGridView on my winform linked to a BindingSource linked to a Linq to SQL class.
My problem is when I update my underlying class, the BindingSource will not notified and my DataGridView will not update.
What should I do to resolve this problem?
|
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: 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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |