Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6474571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:36:10+00:00 2026-05-25T06:36:10+00:00

I am working on a project where I am converting some VB.Net class libraries

  • 0

I am working on a project where I am converting some VB.Net class libraries to C# libraries (mostly to learn C# syntax). My problem is that I cannot get the Save function working.

I am building my object with this:

    public static StoreEmployee Create(string LoginId)
    {
        var emp = new StoreEmployee();
        using (var dt = DAC.ExecuteDataTable("usp_ActiveEmployeeSelect", 
            DAC.Parameter(CN_LoginId, LoginId)))
        {
            emp.StoreId = Convert.ToString(dt.Rows[0][CN_StoreId]);
            emp.FirstName = Convert.ToString(dt.Rows[0][CN_FirstName]);
            emp.LastName = Convert.ToString(dt.Rows[0][CN_LastName]);
            emp.UserName = Convert.ToString(dt.Rows[0][CN_UserName]);
            emp.Role = Convert.ToString(dt.Rows[0][CN_Role]);
            emp.Description = Convert.ToString(dt.Rows[0][CN_Description]);
        }
        return emp;
    }

And then creating it with this

    private static void FillStoreEmployeeObject(string empLoginId)
    {
        StoreEmployee.Create(empLoginId);
    }

And then trying to use this save function to save the object back to the database:

    public override Boolean Save(string LoginId)
    {
        try
        {
            int retVal = DAC.ExecuteNonQuery("usp_ActiveEmployeeSave",
                DAC.Parameter(CN_LoginId, LoginId),
                DAC.Parameter(CN_StoreId, StoreId),
                DAC.Parameter(CN_FirstName, FirstName),
                DAC.Parameter(CN_UserName, UserName),
                DAC.Parameter(CN_Role, Role),
                DAC.Parameter(CN_Description, Description));
            return true;
        }
        catch
        {
            return false;
        }
    }

I don’t get a syntax warning for that but I have revised it many times so I want to make sure that is correct before I move on. Does this look correct? By the way I am trying to call the Save function with this

StoreEmployee.Save(Convert.ToString(Login))

which gives me this error An object reference is required for the non-static field, method, or property However when I mark my function as static my Create function shows errors so I am left very confused.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:36:10+00:00Added an answer on May 25, 2026 at 6:36 am

    Save is an instance method.

    As the error message states,you need to call it on an existing instance of StoreEmployee (such as the one returned by Create).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project that involves converting a large amount of HTML content
I'm working on project that lets users choose some scientific authors and columnists and
I'm currently working on a project Euler problem (www.projecteuler.net) for fun but have hit
I'm converting a large, multi-project CVS repository into Subversion using cvs2svn. It's working really
I working on project and have problem with threading and update of UI. I
I'm currently working on project with Haskell, and have found myself some trouble. I'm
I am working a project that does not have a trunk / branches /
I am working a project with many NUnit tests, that were already written long
I'm working on a solution with multiple projects (class libraries, interop, web application, etc)
I am currently working on an ASP.NET MVC2 project. This is the first time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.