Thirunavukkarsu j

Thirunavukkarsu j

  • 2k
  • 196
  • 85.5k

Fill: SelectCommand.Connection property has not been initial

Jan 31 2013 7:44 AM
 

I got this error on the program I am creating. After reading some forums and same problems on the net, I've finalyy figured out what the problem is..

The errors appears when I try to get records from the database. The code looks like:





{
       
        string qryStr = "select [Course Description],[Fee Name] from Course,Fee_Specification where [Course Code]=Class and [Course Description]='" + ddlCourseCode.SelectedItem.Text + "' group by  [Course Description],[Fee Name]";
        DataSet ds;
        dap = new SqlDataAdapter(qryStr,con);
        ds = new DataSet(qryStr);
        dap.Fill(ds, "Course,Fee_Specification");
        CheckBoxList1.DataSource = ds.Tables[0].DefaultView;
        CheckBoxList1.DataTextField = "Fee Name";
        CheckBoxList1.DataBind();

    }

Answers (9)