Solved

No Overload for Method Error Asp.net, C#

Posted on 2012-03-25
11
440 Views
Last Modified: 2012-03-31
I am get a "no overload for metod error in the line
"dsEmployeeName = oEmployeeName.GetEmployeeName(intEmployeeID);"
in the below code.  Can some tell me why this error is occurring and show me what to do to correct it:

Thanks!

protected void Page_Load(object sender, EventArgs e)
        {
            oEmployeeName = new EmployeeOrdersBAL();

            lblSystemMessages.Text = "";
            lblSuccessMessages.Text = "";
            pnlSystemMessages.CssClass = "";

            //add in code about success message coming back from add child.
            if (Session["oSuccess"] != null)
            {
                lblSuccessMessages.Text = Session["oSuccess"].ToString();
                Session["oSuccess"] = null;
            }

            if (Session["oEmployeeID"] != null)
            {
                intEmployeeID = Convert.ToInt32(Session["oEmployeeID"].ToString());
            }

            if (!IsPostBack)
            {
                Session["oPageMode"] = null;

                if (intEmployeeID > 0)
                {
                    oEmployeeName = new EmployeeOrdersBAL();
                    try
                    {
                        //clear all sessions
                        Session["oEMPLName"] = null;

                        DataSet dsEmployeeName = new DataSet();
                        dsEmployeeName = oEmployeeName.GetEmployeeName(intEmployeeID);
                        if (dsEmployeeName != null)
                        {
                            DisplayEmployeeName(dsCRPDDDiagnosis.Tables[0]);

                        }
                    }

                    catch
                    {
                    }
                    finally
                    {
                        oEmployeeName = null;
                    }

                }
                else
                {
0
Comment
Question by:jordanhelen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37763143
Can you post you oEmployeeName hear??

Check the Method argument type of

oEmployeeName.GetEmployeeName(intEmployeeID);

Is it of Int type or what??

As your error shows that there is not method in oEmployeeName with the name GetEmployeeName which aspect the int parameter.
0
 

Author Comment

by:jordanhelen
ID: 37763268
Please see the first part of the class.

oEmployeeName is a session variable geting it's value from what the user selects.
0
 

Author Comment

by:jordanhelen
ID: 37763274
oops . . .  left it our

Please see the first part of the class.

oEmployeeName is a session variable geting it's value from what the user selects.

public partial class EmployeeOrdersAssessment : System.Web.UI.Page
    {
        oUserObject oUser = null;
        EmployeeOrdersBAL oEmployeeName = null;
        int intEmployeeID = 0;

protected void Page_Load(object sender, EventArgs e)
        {
            oEmployeeName = new EmployeeOrdersBAL();   . . . .
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37763278
Had you posted your Class Code.I Can't see that. I can see on the Page_Load section of the ASpx Code-Behind section.and, in that  oEmployeeName is not comming from Session. You are creating it with

    oEmployeeName = new EmployeeOrdersBAL();    //First line of Page_Load method.
0
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37763282
ok. Can you tell me where you are initializing the oEmployeeName  variable from session.
I can't see that section.
0
 

Author Comment

by:jordanhelen
ID: 37763438
Thank you!

The  "dsEmployeeName = oEmployeeName.GetEmployeeName(intEmployeeID);"

links to the  EmployeeOrdersBAL (business access layer class) it is here where the code that initializes this variable is located.

Also after

 }
         else
  {

there are only error messages.

After the error message, grid binding takes place.  See below

protected void DisplayEmployeeName (DataTable dtEmployeeName)
        {
            try
            {
                DataView dvEmployeeName = dtEmployeeName.DefaultView;
                dvCEmployeeName.Sort = "ChronologicalAge DESC";
                Session["oEMPLName"] = dvEmployeeName;
                grdEmployeeResults.DataSource = dvEmployeeName;
                grdEmployeeResults.DataBind();
            }
            catch
            {
                throw;
            }
        }

Basically this is all except page sorting, index changing, etc.  Ofcourse I am not getting that far. The problem may be in the BAL.  What are you thoughts?
0
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37763439
friend, i think the problem is with the line
oEmployeeName.GetEmployeeName(intEmployeeID)

if possible ,then please check your B.L ,and make sure that  oEmployeeName object contains the GetEmployeeName method whitch takes the integer parameter.
0
 

Author Comment

by:jordanhelen
ID: 37763515
Yes, I agree, it is in that line.  The GetEmployeeName method is in the BL and this method is set to the variable oEmployeeName when it is declared in the .aspx behind code.

Thanks for your help.
0
 
LVL 7

Assisted Solution

by:Lalit Chandra
Lalit Chandra earned 250 total points
ID: 37763526
if you issue had been solved then you should close this post.
0
 
LVL 21

Accepted Solution

by:
masterpass earned 250 total points
ID: 37763845
This error is coz of the fact that you are either supplying more parameters or less parameters to the "GetEmployeeName()" function. Your function call does not meet the function signature. Have a look at your BL and then see how many parameters is the function supposed to accept! If this does not solve the problem,can you post your BL code logic here?

hope this helps
0
 

Author Comment

by:jordanhelen
ID: 37791021
No Comments.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question