Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 14 Aug 2008 05:28:44 -0700 (PDT),    group: microsoft.public.dotnet.framework.windowsforms        back       


Cannot seem to update underlying DataAdapter with Values in Datagrid   
I'm new to .NET, but certainly not new to development work.  I've been
trying everything I can think of to get the worlds simplest
implementation of a DataGrid to actually update the changes back to
the database.  I've been working on it for two days and I can't seem
to get my "Hello World" datagrid implementation to work.

ANY guidance would be most appreciated.  I've tried numerous code
solutions, but none commit any changes back to the database and none
give any sort of error messages.

I simply plopped a datagrid on the form, answered the dialog about
what datasource to use, chose the insert, update, delete checkboxes,
etc...  and thought that would be enough.  Obviously, it wasn't.
Then, I found all kinds of examples about using HasChanged to
determine if changes had been made and then dataAdapter.Update to
commit the changes.  Nothing worked.

I can't believe it's this hard.  I know I'm doing something wrong, but
for the life of me I can't figure out what it is.  I'll be happy to
post whatever code snippets are needed or even the entire project if
it will help.

Thanks in advance.
date: Thu, 14 Aug 2008 05:28:44 -0700 (PDT)   author:   unknown

Re: Cannot seem to update underlying DataAdapter with Values in Datagrid   
On Thu, 14 Aug 2008 05:28:44 -0700, gmartin wrote:

> I can't believe it's this hard.  I know I'm doing something wrong, but
> for the life of me I can't figure out what it is.  I'll be happy to post
> whatever code snippets are needed or even the entire project if it will
> help.

You are not alone with that idea.  This will commit everything that has 
updated.

var BindingSourcesQuery =
    from Component bindingSources in this.components.Components
    where bindingSources is BindingSource
    select bindingSources;

    foreach (BindingSource bindingSource in BindingSourcesQuery)
    {
        bindingSource.EndEdit();
    }


tableAdapterManager.UpdateAll(yourDataset);
date: 14 Aug 2008 23:03:17 +1000   author:   Ken

Re: Cannot seem to update underlying DataAdapter with Values in Datagrid   
My bad.  I didn't mention that I was working in VB.NET.  I pasted the
code into the FormClosing event and VB didn't like it at all.  Looks
like it might be C.  Do you have the VB equivalent?

Thank you so much for your help.
date: Thu, 14 Aug 2008 07:29:06 -0700 (PDT)   author:   unknown

Re: Cannot seem to update underlying DataAdapter with Values in Datagrid   
I found my answer finally and I'm probably more ticked off now than
before I started this cursed experiment.  Found this little tidbit in
another forum...

++++++++++++++++++++++++++++++++++++++++++++++
In addition:
Select/click your database file in Solution Explorer
-> Properties Pane
-> change the "copy to ouput directory" to "copy if newer"
++++++++++++++++++++++++++++++++++++++++++++++

Did that and everything started working like a champ.  What bugs me is
that this means that probably every single permutation that I tried
over the past two days was probably working perfectly.  I just
couldn't tell because I kept looking at an older copy of the database.

AAAAAAAAAAAAGGGGGGGGGGGGGHHHHHHHHHHHHHHHHH!!!

Anyway, thanks for trying to help.  I really do appreciate it.
date: Thu, 14 Aug 2008 09:57:41 -0700 (PDT)   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us