1

Getting three errors:

  1. cannot convert from 'employer' to 'JobPortalModel.employer'

  2. The best overloaded method match for System.Data.Objects.ObjectSet.AddObject (JobPortalModel.employer)' has some invalid arguments

  3. 'employer' does not contain a definition for 'c_type' and no extension method
    'c_type' accepting a first argument of type 'employer' could be found (are you missing a using directive or an assembly reference

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using JobPortalModel;
    
    public partial class Reg_employer : System.Web.UI.Page
    {
        JobPortalEntities je1= new JobPortalEntities();
        protected void Page_Load(object sender, EventArgs e)
        {
            acctyp.Text = Session["Account"].ToString();
    
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string Type = acctyp.Text;
            string Name = txtname.Text;
            string Email = txtmail.Text;
            string Password = txtpass.Text;
            string RePassword = txtrepass.Text;
            string Details = txtdtls.Text;
            string Website = txtwbst.Text;
            string Image=fplg.FileName;
            string ext = System.IO.Path.GetExtension(Image).ToLower();
            if (ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".jpg")
            {
                string sp = Server.MapPath("~") + "\\logo//" + Image;
                fplg.SaveAs(sp);
                string ps = "~/logo/" + Image;
                employer e2=new employer();
                    e2.c_type = Type;
                    e2.c_name = Name;
                    e2.c_mail = Email;
                    e2.c_pass = Password;
                    e2.c_repass = RePassword;
                    e2.c_details = Details;
                    e2.c_website = Website;
                    e2.c_img = ps;
                    je1.employer.AddObject(e2);
                    je1.SaveChanges();
    
            }
    
            Response.Redirect("Default.aspx");
    
        }
    
        private string conv(string p)
        {
            throw new NotImplementedException();
        }
    }
    
1
  • Please Help/.. I am new in .Net Commented Dec 14, 2013 at 20:16

1 Answer 1

1

Looks like you have an employer class somewhere, which is conflicting with JobPortalModel.employer. You can do like this:

//employer e2=new employer();
JobPortalModel.employer e2=new JobPortalModel.employer();

You need to be careful about naming variables. Change this:

string Type = acctyp.Text;
... ... ...
string Image=fplg.FileName;

To this:

string type = acctyp.Text;
... ... ...
string image=fplg.FileName;

And change this:

string sp = Server.MapPath("~") + "\\logo//" + Image;
                ... ... ...
                string ps = "~/logo/" + Image;
                ... ... ...
                    e2.c_type = Type;

To this:

string sp = Server.MapPath("~") + "\\logo//" + image;
                ... ... ...
                string ps = "~/logo/" + image;
                ... ... ...
                    e2.c_type = type;

You can find Microsoft's naming guideline here.

Sign up to request clarification or add additional context in comments.

2 Comments

@Sayantan Das - unlike other forums we prefer accepting and/or upvoting an answer if it helps. Please see How does accepting an answer work?.
I cant vote up ur answer.. sorry sir.. Its saying I need some reputation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.