Solved

reference data

Posted on 2015-02-02
10
84 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

943 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

18 Experts available now in Live!

Get 1:1 Help Now