Solved

reference data

Posted on 2015-02-02
10
83 Views
Last Modified: 2015-02-09
Here is my code:

 Private Sub frmCompInfo_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'TODO: This line of code loads data into the 'CompanyInfo._CompanyInfo' table. You can move, or remove it, as needed.
        Me.CompanyInfoTableAdapter.Fill(Me.CompanyInfo._CompanyInfo)

    End Sub

then I go to update it off of a Save Button

Me.CompanyInfoTableAdapter.Update(Me.CompanyInfo._CompanyInfo.GetChanges)

AND I get this error

argument null exception was unhandled
 vb.net vs2012
0
Comment
Question by:MBHEY131
  • 7
  • 3
10 Comments
 
LVL 23

Expert Comment

by:Michael74
ID: 40585344
It sounds like one of the objects in the offending line has not been initiated.

Place a break point at this line and then check the values of the objects in the call.
0
 

Author Comment

by:MBHEY131
ID: 40585381
I tried that and all looks well
It loads to the form and all textboxes that it's bound to

<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
         Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0"), _
         Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")> _
        Public Overridable Overloads Function Update(ByVal dataTable As CompanyInfo.CompanyInfoDataTable) As Integer
            Return Me.Adapter.Update(dataTable) <<< Errors out here the datatable is nothing
        End Function

but it's passed from here

 Me.CompanyInfoTableAdapter.Update(Me.CompanyInfo._CompanyInfo.GetChanges)

I mouse over and the data is in the ta and the ds and dt??? all have proper data
I'm stumped Which doesn't take to much.
0
 
LVL 23

Expert Comment

by:Michael74
ID: 40585393
You are passing the results of the method GetChanges not the datatable itself. What happens if you pass just Me.CompanyInfo._CompanyInfo.
0
 

Author Comment

by:MBHEY131
ID: 40585416
Well I don't get any errors and it seems to bring over the data table name correctly
But it will not update any changes I make to the table???

that's progress anyway - what do I do now?
0
 
LVL 23

Assisted Solution

by:Michael74
Michael74 earned 500 total points
ID: 40585421
Update the table then pass it to the function eg

Me.CompanyInfo._CompanyInfo.GetChanges
Me.CompanyInfoTableAdapter.Update(Me.CompanyInfo._CompanyInfo)

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:MBHEY131
ID: 40585457
everything seems to be going where it should and be in the proper places
But - it still will not push the changes to the data table in the database????
0
 

Author Comment

by:MBHEY131
ID: 40585459
table gets updated properly because I have it on the scope in the debugger, but no dice.
0
 

Author Comment

by:MBHEY131
ID: 40587023
Does anybody have any other  advice - this issue is holding up my whole project basically
Should I populate straight from a SQL
0
 

Accepted Solution

by:
MBHEY131 earned 0 total points
ID: 40589724
SOLVED:
In my situation you need to call:
     
  Me.CompanyInfoBindingSource.EndEdit()

        before:

        Me.CompanyInfo._CompanyInfo.GetChanges()
        Me.CompanyInfoTableAdapter.Update(Me.CompanyInfo._CompanyInfo)

And much joy will be had!!!
0
 

Author Closing Comment

by:MBHEY131
ID: 40597963
Me.CompanyInfo._CompanyInfo.GetChanges()
        Me.CompanyInfoTableAdapter.Update(Me.CompanyInfo._CompanyInfo)

Got me on the right track
But:

        Me.CompanyInfoBindingSource.EndEdit()

Needed to be added
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

If your app took Google’s lash recently, here are the 5 most likely reasons.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now