Bob Lewiston

Bob Lewiston

  • NA
  • 88
  • 0

help with BindingSources

Apr 5 2009 1:40 PM

I need some help with BindingSources.

This is what I'm working on:

From the C# tutorial at Programmer's Heaven (http://www.programmersheaven.com/2/Les_CSharp_13_p9):

private void btnLoadData_Click(object sender, System.EventArgs e)
{
    string connectionString = "server=P-III; database=programmersheaven; uid=sa; pwd=;";
    SqlConnection conn = new SqlConnection (connectionString);
    string cmdString = "SELECT * FROM article";
    SqlDataAdapter dataAdapter = new SqlDataAdapter (cmdString, conn);
    DataSet ds = new DataSet ();
    dataAdapter.Fill (ds, "article");
    dgDetails.SetDataBinding (ds, "article");
}

When I try to compile this, I get the following error: "The name 'dgDetails' does not exist in the current context".

I have just been told that dgDetails is a BindingSource. I'm a newbie, so I'm not familiar with BindingSources.

Could you tell me what I need to include in my code to get the compiler to recognize the dgDetails BindingSource and compile my app?