Abhishek  Jaiswal

Abhishek Jaiswal

  • 95
  • 19.8k
  • 9.6m

Getting this error

Jul 8 2014 8:33 AM
hello!

my code for select operation is
 protected void Button1_Click(object sender, EventArgs e)
    {
        string strcon = ConfigurationManager.ConnectionStrings["masterConnectionString"].ConnectionString;
        // Creating SQL connection
        SqlConnection con = new SqlConnection(strcon);
        // Connection open
        con.Open();
        SqlCommand cmd = new SqlCommand("SELECT * FROM SignUp", con);
        DataSet ds = new DataSet("SignUpDataSet");         
        SqlDataAdapter rdr = new SqlDataAdapter (cmd);
        rdr.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
        con.Close();
       
    }

but am getting this error on button click event:

Both DataSource and DataSourceID are defined on 'GridView1'.  Remove one definition.

        rdr.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
        con.Close();


please, help!

Answers (1)