-1
<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=(local);Initial catalog=sonia;User ID=sonia;Password=sonia;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
public partial class Frmgrid : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    SqlDataAdapter da;
    DataSet ds;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            da = new SqlDataAdapter("SELECT * FROM Products", conn);
            da.Fill(ds, "tb1");
            DropDownList1.DataSource = ds.Tables["tb1"];
            DropDownList1.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }        
}

ERROR is dere while executing the line da.Fill(ds, "tb1");
"Value cannot be null.\r\nParameter name: dataSet"

Edited by sonia sardana: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by guru_sarkar
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.