473,770 Members | 6,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data binding: object reference required

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

...

private TB_ACTHEATDATAD ataTable tableTB_ACTHEAT DATA;

...

public TB_ACTHEATDATAD ataTable TB_ACTHEATDATA {
get {
return this.tableTB_AC THEATDATA;
}
}

...
}
and a component for editin it
MMSDBEditContro l:

with

partial class MMSDBEditContro l
{

private void InitializeCompo nent()
{
...
this.mMSDataSet = new MMSDataAccess.M MSDataSet();
...
}

}
Above is all designer gernerated code.

But when I do:

using MMSDataAccess;
using MMSDataAccess.M MSDataSetTableA dapters;

namespace MMSDBEdit
{

public partial class MMSDBEditContro l : UserControl
{
public MMSDBEditContro l()
{
InitializeCompo nent();
TB_ACTHEATDATAT ableAdapter.Fil l( this.mMSDataSet .TB_ACTHEATDATA ); //
Error here
}

....
}
}
I get
Error 1 An object reference is required for the nonstatic field,
method, or property
'MMSDataAccess. MMSDataSetTable Adapters.TB_ACT HEATDATATableAd apter.Fill(MMSD ataAccess.MMSDa taSet.TB_ACTHEA TDATADataTable) '
C:\Project\MMS\ MMSDBEditContro l.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 2561
On Nov 26, 10:41 am, cppques...@goog lemail.com wrote:
I have a data set
MMSDataAccess
with:
public partial class MMSDataSet : System.Data.Dat aSet {

...

private TB_ACTHEATDATAD ataTable tableTB_ACTHEAT DATA;

...

public TB_ACTHEATDATAD ataTable TB_ACTHEATDATA {
get {
return this.tableTB_AC THEATDATA;
}
}

...
}

and a component for editin it
MMSDBEditContro l:

with

partial class MMSDBEditContro l
{

private void InitializeCompo nent()
{
...
this.mMSDataSet = new MMSDataAccess.M MSDataSet();
...
}

}

Above is all designer gernerated code.

But when I do:

using MMSDataAccess;
using MMSDataAccess.M MSDataSetTableA dapters;

namespace MMSDBEdit
{

public partial class MMSDBEditContro l : UserControl
{
public MMSDBEditContro l()
{
InitializeCompo nent();

TB_ACTHEATDATAT ableAdapter.Fil l( this.mMSDataSet .TB_ACTHEATDATA ); //
Error here
}

...
}

}

I get
Error 1 An object reference is required for the nonstatic field,
method, or property
'MMSDataAccess. MMSDataSetTable Adapters.TB_ACT HEATDATATableAd apter.Fill(MMSD ataAccess.MMSDa taSet.TB_ACTHEA TDATADataTable) '
C:\Project\MMS\ MMSDBEditContro l.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...@goog lemail.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.co mwrote:
On Nov 26, 10:11 am, cppques...@goog lemail.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...@goog lemail.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
3039
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 example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
0
2808
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 sender, System.ComponentModel.CancelEventArgs e) { Control control = (Control) sender; control.BindingContext.EndCurrentEdit(); results.Text = test.BindingTestString;
0
1453
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 sender, System.ComponentModel.CancelEventArgs e) { Control control = (Control) sender; control.BindingContext.EndCurrentEdit(); results.Text = test.BindingTestString;
6
6705
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
2346
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 object to databind to text boxes etc? I can't use a dataset as the object has loads of derived logic, for example updating one property may actually update several database fields for example.
7
4229
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 (DataBindings). - When I display a record and then try to access the .Text property of one of the text boxes on any tab except the current tab, the result is an Empty string.
2
2071
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 a row, I change the textbox (or other control), click Update, but it doesn't save my data. I then did this... In Page_Load, I added code to filter the DataGrid only when it was Not Page.IsPostBack. Then the editing/updating of the DataGrid data...
0
12087
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 likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
6
2421
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 connection string works fine and the tables are added to the project without a problem. When I create the tables they appear to bind and I am able to preview the data in the database in design mode; however, at runtime no data is displayed and the...
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10053
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.