2
Answers

no overload for method takes '1' arguments

Santosh Kumar

Santosh Kumar

11y
5.6k
1
Hi all! 
I have a problem, I am using this code in a software and I am getting a error in GetData(cmd).
I have done it another way but I want to know what's really problem, can anybody help me?

string dbconnection = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
    
    private void BindData()
    {
        SqlConnection con = new SqlConnection(dbconnection);
        string strQuery = "select CustomerID,ContactName,CompanyName " + " from customers";
        SqlCommand cmd = new SqlCommand(strQuery);
        GridView1.DataSource = GetData(cmd);
// => getting eror (no overload for method 'GetData' takes '1' arguments)

        GridView1.DataBind();
    }

    private void GetData()
    {
        GridView1.DataBind();
    }


Thanks

Answers (2)