?
Solved

reference data

Posted on 2015-02-02
10
Medium Priority
?
91 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
10 Comments
 
LVL 23

Expert Comment

by:Michael Fowler
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:Michael Fowler
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
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 

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:Michael Fowler
Michael Fowler earned 2000 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
 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
Starting up a Project
Suggested Courses

770 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