user3363647
user3363647

Reputation: 105

(are you missing a using directive or an assembly reference?)

i am writing common business logic class in App_code folder for connecting to database using EFW.but showing the following error " Error 1 The type or namespace name 'job' could not be found"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;



 namespace WebApplication6.App_Code
    {
        public class BlCommon
        {  
            public List<job> GetJobs()
            {
                pubs2012Entities pubsobject = new pubs2012Entities();
                var x = pubsobject.jobs.ToList<job>();
                return x;
            }
        }
    }


and class generated by EFW from jobs table is

namespace WebApplication6.App_Code

    {
        using System;
        using System.Collections.Generic;

        public partial class job
        {
            public short job_id { get; set; }
            public string job_desc { get; set; }
            public byte min_lvl { get; set; }
            public byte max_lvl { get; set; }
        }
    }

Upvotes: 0

Views: 6004

Answers (2)

Dot_NET Pro
Dot_NET Pro

Reputation: 2123

Ok I got it:

Public List<job> GetJobs()
{
      pubs2012Entities pubsobject = new pubs2012Entities();
        var x = pubsobject.jobs.ToList<job>();
        return x;

}

Click on Job, Move the mouse cursor over the blue dash that appear at the bottom of job click Generate Class and then move your Job.cs code to your new job.cs class and delete the old one. This is image

Upvotes: 0

invernomuto
invernomuto

Reputation: 10211

Seem you dont have a reference to assembly wich contain mentioned class

Upvotes: 2

Related Questions