spots Knight

spots Knight

  • NA
  • 35
  • 2.8k

Second DataSet not recognized

Sep 16 2014 12:57 PM
I am attempting to add a separate distinct dataset to my application. I've created the .xsd file and the class I am working in has the Using Sytem.Data. Everything LOOKS like it should be fine and looks exactly like another class that is the first dataset. However when I declare the dataset to create an instance of it, the code does not recognize it. They are both in the same namespace.

I'm fairly sure it is something simple I'm missing but I just can't see what.

This works
    class ExportYTDs
    {
        OleDbDataAdapter dadapt = new OleDbDataAdapter();

        public void ExportFile(string ExportfilePath, string coNumber, OleDbConnection dbConn)
        {
            try
            {
                    String lSQL = "my sql Statement Here";
                    dadapt = new OleDbDataAdapter(lSQL, dbConn);

                    ds DSCo = new ds(); // <------- This is my dataset declaration that works

                    DSCo.ExportYTD.Clear(); //Clear Table
                    dadapt.Fill(DSCo.ExportYTD); //Fill table based on above SQL

                    //Export the data
                    if (ExportYTD.Rows.Count > 0)
                    { //Code to export to Excel Here }

            }
            catch (Exception ex)
            {//Handle Errors }
        }

This DOESN'T :(
    class ExportCoProfile
    {
        OleDbDataAdapter dadapt = new OleDbDataAdapter();

        public void ExportFile(string ExportfilePath, string coNumber, OleDbConnection dbConn)
        {
            try
            {
                   String lSQL = "my sql Statement Here";
                    dadapt = new OleDbDataAdapter(lSQL, dbConn);

                    cp Profile= new cp(); // <------- This is my dataset declaration that fails

                    Profile.coProfile.Clear(); //Clear Table
                    dadapt.Fill(Profile.coProfile); //Fill table based on above SQL

                    //Export the data
                    if (CoProfile.Rows.Count > 0)
                    { //Code to export to Excel Here }

            }
            catch (Exception ex)
            {//Handle Errors }
        }

Answers (1)