Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

the best overloaded method match for 'TaskDataAccess.SearchUser(Task, string)' has some invalid arguments

Posted on 2007-11-16
4
Medium Priority
?
732 Views
Last Modified: 2012-05-05
Hi experts,
how do i fix the above error?
in my class file i have this code
=====================================
public static DataTable SearchUser(Task userSearch, string search)
 {
     SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
     DataTable dt = new DataTable();
     myConnection.Open();
       try {
           SqlCommand cmdLicense = new SqlCommand("SPR_SEARCH_USERPROFILE", myConnection);
         cmdLicense.CommandType = CommandType.StoredProcedure;
         cmdLicense.Parameters.AddWithValue("@search", search);
         SqlDataAdapter adapter = new SqlDataAdapter(cmdLicense);
         adapter.Fill(dt);
     }
    catch (SqlException sqlexp)
       {
       
           throw (sqlexp);
     }
     myConnection.Close();
     return dt;
 }

======================in my code behind i tried to call SearchUser=================
 protected void btnSearch_Click(object sender, EventArgs e)
    {
        Task userSearch;
        //makes a call to SearchUser function
        DataTable dt = TaskDataAccess.SearchUser(userSearch, this.txtSearch);=======errors here
       if (dt.Rows.Count > 0)
        {
            //GridView1.CurrentPageIndex = 0;
            GridView1.DataSource = dt;
            GridView1.DataBind();
          //  lblmsg.Text = "";
            GridView1.Enabled = true;
        }
        else
        {
           // lblmsg.Text = "User not found";
            //dgUsers.Enabled = false;
        }
    }
===================================================================================
0
Comment
Question by:SirReadAlot
[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
  • 2
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20297169
       DataTable dt = TaskDataAccess.SearchUser(userSearch, this.txtSearch.Text);
0
 

Author Comment

by:SirReadAlot
ID: 20297186
ohh, i forgot the text.

but i declared Task userSearch;

how comes i get this error saying "Use of unassigned local variable 'userSearch'"

 DataTable dt = TaskDataAccess.SearchUser(userSearch, this.txtSearch.Text);

THANKS
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20297204
>but i declared Task userSearch;
yes, declared, but not initialized-

Task userSearch = new Task();

might need additional parameters for the Task() constructor
0
 

Author Closing Comment

by:SirReadAlot
ID: 31409523
thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 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