473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Data binding: object reference required

I have a data set
MMSDataAccess
with:
public partial class MMSDataSet : System.Data.DataSet {

...

private TB_ACTHEATDATADataTable tableTB_ACTHEATDATA;

...

public TB_ACTHEATDATADataTable TB_ACTHEATDATA {
get {
return this.tableTB_ACTHEATDATA;
}
}

...
}
and a component for editin it
MMSDBEditControl:

with

partial class MMSDBEditControl
{

private void InitializeComponent()
{
...
this.mMSDataSet = new MMSDataAccess.MMSDataSet();
...
}

}
Above is all designer gernerated code.

But when I do:

using MMSDataAccess;
using MMSDataAccess.MMSDataSetTableAdapters;

namespace MMSDBEdit
{

public partial class MMSDBEditControl : UserControl
{
public MMSDBEditControl()
{
InitializeComponent();
TB_ACTHEATDATATableAdapter.Fill( this.mMSDataSet.TB_ACTHEATDATA); //
Error here
}

....
}
}
I get
Error 1 An object reference is required for the nonstatic field,
method, or property
'MMSDataAccess.MMSDataSetTableAdapters.TB_ACTHEATD ATATableAdapter.Fill(MMSDataAccess.MMSDataSet.TB_A CTHEATDATADataTable)'
C:\Project\MMS\MMSDBEditControl.cs 20
Does somebody understand why that is?
I would think the Fill method got exactly what it is demanding.

Thanks,
Marc
Nov 26 '07 #1
4 2546
On Nov 26, 10:41 am, cppques...@googlemail.com wrote:
I have a data set
MMSDataAccess
with:
public partial class MMSDataSet : System.Data.DataSet {

...

private TB_ACTHEATDATADataTable tableTB_ACTHEATDATA;

...

public TB_ACTHEATDATADataTable TB_ACTHEATDATA {
get {
return this.tableTB_ACTHEATDATA;
}
}

...
}

and a component for editin it
MMSDBEditControl:

with

partial class MMSDBEditControl
{

private void InitializeComponent()
{
...
this.mMSDataSet = new MMSDataAccess.MMSDataSet();
...
}

}

Above is all designer gernerated code.

But when I do:

using MMSDataAccess;
using MMSDataAccess.MMSDataSetTableAdapters;

namespace MMSDBEdit
{

public partial class MMSDBEditControl : UserControl
{
public MMSDBEditControl()
{
InitializeComponent();

TB_ACTHEATDATATableAdapter.Fill( this.mMSDataSet.TB_ACTHEATDATA); //
Error here
}

...
}

}

I get
Error 1 An object reference is required for the nonstatic field,
method, or property
'MMSDataAccess.MMSDataSetTableAdapters.TB_ACTHEATD ATATableAdapter.Fill(MMSDataAccess.MMSDataSet.TB_A CTHEATDATADataTable)'
C:\Project\MMS\MMSDBEditControl.cs 20

Does somebody understand why that is?
I would think the Fill method got exactly what it is demanding.

Thanks,
Marc
ok, found the solution myself:
The object reference required related to the object on which Fill was
called
(this).

However: Why there is no tebale adapter hold by the MMSDataSet
as it holds the table itself as well?
Nov 26 '07 #2
On Nov 26, 10:11 am, cppques...@googlemail.com wrote:

<snip>
The object reference required related to the object on which Fill was
called (this).

However: Why there is no tebale adapter hold by the MMSDataSet
as it holds the table itself as well?
The adapter populates the data set, but there's no reason for the data
set to keep hold of the table adapter. In particular, a single table
adapter could populate many data sets. It's just a conduit between the
in memory data and the database, really.

Jon
Nov 26 '07 #3
On Nov 26, 11:19 am, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Nov 26, 10:11 am, cppques...@googlemail.com wrote:

<snip>
The object reference required related to the object on which Fill was
called (this).
However: Why there is no tebale adapter hold by the MMSDataSet
as it holds the table itself as well?

The adapter populates the data set, but there's no reason for the data
set to keep hold of the table adapter. In particular, a single table
adapter could populate many data sets. It's just a conduit between the
in memory data and the database, really.

Jon
Thanks for the answer.
So everytime a TA is needed I should create it new?
That leaves no big overhead? Or is there even a benefit
(e.g. releasing memory used for the fill)?

Marc
Nov 26 '07 #4
On Nov 26, 4:22 pm, cppques...@googlemail.com wrote:
Thanks for the answer.
So everytime a TA is needed I should create it new?
That leaves no big overhead? Or is there even a benefit
(e.g. releasing memory used for the fill)?
I'm not an expert on the adapter side of things, but I believe it's
fine to create a new one each time.

Jon
Nov 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
6
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
19
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
7
by: Andrew McKendrick | last post by:
Hi, I've noticed a bug in VB.NET (latest .NET Framework)... - I have a TabControl on a form with several tabs. - Each tab contains text boxes that are bound to fields in a data source...
2
by: Gummy | last post by:
Hello All, I have a webpage that has two dropdown listboxes. Based on what is selected in these dropdown listboxes, it filters a DataGrid . That works fine. In the DataGrid , when I go to edit...
0
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the...
6
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.