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.WebA ccountTabl eAdapter WebAccountTableAdapter1;
WebAccountTableAdapter1 = new DataSet5TableAdapters.WebA ccountTabl eAdapter() ;
WebAccountTableAdapter1.Fi llByUser(D ataSet5.We bAccount, 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.
I'm trying to fill a dataset on page load and my code looks like this:
DataSet5TableAdapters.WebA
WebAccountTableAdapter1 = new DataSet5TableAdapters.WebA
WebAccountTableAdapter1.Fi
(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);
}
}
Where is "DataSet5.WebAccount" defined?
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.WebA ccountTabl eAdapter but it didn't help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!