Link to home
Start Free TrialLog in
Avatar of ogmike2000
ogmike2000

asked on

Trying to fill a dataset on page load in c#

I'm am new to c# and I'm still having the following problem after a lot of searching:
I'm trying to fill a dataset on page load and my code looks like this:

DataSet5TableAdapters.WebAccountTableAdapter WebAccountTableAdapter1;
        WebAccountTableAdapter1 = new DataSet5TableAdapters.WebAccountTableAdapter();
        WebAccountTableAdapter1.FillByUser(DataSet5.WebAccount, Profile.UserName);

(full code is attached below"

I'm getting the following error:  
Error      1      An object reference is required for the non-static field, method, or property 'DataSet5.WebAccount.get'

I can't see what I'm missing.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Shared;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet5TableAdapters.WebAccountTableAdapter WebAccountTableAdapter1;
        WebAccountTableAdapter1 = new DataSet5TableAdapters.WebAccountTableAdapter();
        WebAccountTableAdapter1.FillByUser(DataSet5.WebAccount, Profile.UserName);
      
    }

}

Open in new window

Avatar of kaufmed
kaufmed
Flag of United States of America image

Where is "DataSet5.WebAccount" defined?
Avatar of ogmike2000
ogmike2000

ASKER

I believe part of the problem is the fact that I used the dataset designer in VS2010.  It's my understanding that you don't have to define and existing dataset created through the designer but as most always, i am probably wrong.  I did try:  using DataSet5TableAdapters.WebAccountTableAdapter but it didn't help.
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!