• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1053
  • Last Modified:

CS0117 problem

We keep having a CS0117 error and don't understand why. We have 2 datagrid, "stagiaires" and "groupes", they are made the same way, but we keep having the error message "does not contain a definition for GRP_Groupes" at the line 60 :
DAGroupes.Fill( DS1.GRP_Groupes );

Here is the complete code :

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace ATX_FINALE
{
  using ucs;

      /// <summary>
      /// Summary description for stagiaires.
      /// </summary>
      public class stagiaires : System.Web.UI.Page
      {
    protected ATX_FINALE.DSListeStagiaires DS1;
    protected System.Data.OleDb.OleDbConnection DBConnATX;

    protected System.Data.OleDb.OleDbDataAdapter DAStagiaires;
    protected System.Data.OleDb.OleDbDataAdapter DAClient;
    protected System.Data.OleDb.OleDbDataAdapter DAGroupes;
      
    protected System.Web.UI.WebControls.DataGrid DGStagiaires;
    protected System.Web.UI.WebControls.DataGrid DGGroupes;
      
    protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
    protected System.Data.OleDb.OleDbCommand oleDbSelectCommand2;
    protected System.Data.OleDb.OleDbCommand oleDbSelectCommand3;
    protected System.Data.OleDb.OleDbCommand oleDbSelectCommand4;
    protected System.Data.OleDb.OleDbCommand oleDbSelectCommand5;
      
    protected System.Web.UI.WebControls.Label LblNone;
    protected System.Web.UI.WebControls.HyperLink HLAjoutStagiaire;
    protected System.Web.UI.WebControls.Label LblNomClient;
    protected System.Web.UI.WebControls.HyperLink HLRetour;
    protected System.Web.UI.WebControls.Label LblNone2;
    protected System.Web.UI.WebControls.HyperLink HLRetour2;

      protected PageEnteteMenu PageEnteteMenu1;

            private void Page_Load(object sender, System.EventArgs e)
            {
            HLRetour.NavigateUrl = "client2.aspx?id=" + Request.QueryString["id"];
            
            // lecture du client
            DAClient.SelectCommand.Parameters["CLI_Id"].Value = new Guid( Request.QueryString["id"] );
            DAClient.Fill( DS1.CLI_Client );
            LblNomClient.Text = DS1.CLI_Client[0].CLI_RaisonSociale;
            HLAjoutStagiaire.NavigateUrl = "stagiaire_fiche.aspx?cli=" + DS1.CLI_Client[0].CLI_Id.ToString();
            
            // lecture des groupes
            if ( !IsPostBack ) {
              DAGroupes.SelectCommand.Parameters["GRP_CLI_Id"].Value = new Guid( Request.QueryString["id"] );
              DAGroupes.SelectCommand.CommandText += " ORDER BY GRP_Nom";
              DAGroupes.Fill( DS1.GRP_Groupes );
//              if ( DS1.GRP_Groupes.Count > 0 )      
//            {
//               LblNone2.Visible = false;
//                  DataBind();
//            }
//              else
//                DGGroupes.Visible = false;
            }


      // lecture des stagiaires
      if ( !IsPostBack )
      {
        DAStagiaires.SelectCommand.Parameters["STA_CLI_Id"].Value =
          new Guid( Request.QueryString["id"] );
        DAStagiaires.SelectCommand.CommandText += " ORDER BY STA_Nom";
        DAStagiaires.Fill( DS1.STA_Stagiaire );
        if ( DS1.STA_Stagiaire.Count > 0 )      
            {
              LblNone.Visible = false;
                DataBind();
             }
        else
          DGStagiaires.Visible = false;
          }

            }

            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.DBConnATX = new System.Data.OleDb.OleDbConnection();
                  this.DS1 = new ATX_FINALE.DSListeStagiaires();
                  
                  this.DAStagiaires = new System.Data.OleDb.OleDbDataAdapter();
                  this.DAClient = new System.Data.OleDb.OleDbDataAdapter();
                  this.DAGroupes = new System.Data.OleDb.OleDbDataAdapter();
                  
                  this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
                  this.oleDbSelectCommand2 = new System.Data.OleDb.OleDbCommand();
                  this.oleDbSelectCommand3 = new System.Data.OleDb.OleDbCommand();       
                  this.oleDbSelectCommand4 = new System.Data.OleDb.OleDbCommand();       
                  this.oleDbSelectCommand5 = new System.Data.OleDb.OleDbCommand();

                  this.DGStagiaires.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DGStagiaires_SortCommand);
                  this.DGStagiaires.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DGStagiaires_ItemDataBound);
                  this.DGGroupes.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DGGroupes_SortCommand);
                  this.DGGroupes.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DGGroupes_ItemDataBound);
 
                    ((System.ComponentModel.ISupportInitialize)(this.DS1)).BeginInit();
      //
      // DBConnATX
      //
      this.DBConnATX.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=""C:\_capserveur1\Database\ATX\ATX.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False";
      //
      // DS1
      //
      this.DS1.DataSetName = "DSListeStagiaires";
      this.DS1.Locale = new System.Globalization.CultureInfo("fr-FR");
      //
      // oleDbSelectCommand1
      //
      this.oleDbSelectCommand1.CommandText = "SELECT CLI_Adresse1, CLI_Adresse2, CLI_Convention, CLI_CP, CLI_Denomination, CLI_" +
        "EMail, CLI_FAS_Id, CLI_Fax, CLI_Id, CLI_Mobile, CLI_RaisonSociale, CLI_Reference" +
        ", CLI_Site, CLI_Suppression, CLI_Telephone, CLI_Ville FROM CLI_Client,WGS_StagiairesParGroupe,GRP_Groupe " +
            " WHERE (CLI" +
        "_Id = ?)";
      this.oleDbSelectCommand1.Connection = this.DBConnATX;
      this.oleDbSelectCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("CLI_Id", System.Data.OleDb.OleDbType.Guid, 0, "CLI_Id"));
      //
      // DAStagiaires
      //
      this.DAStagiaires.SelectCommand = this.oleDbSelectCommand3;
        this.DAStagiaires.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "STA_Stagiaire", new System.Data.Common.DataColumnMapping[] {
                  new System.Data.Common.DataColumnMapping("STA_Adresse1", "STA_Adresse1"),
                  new System.Data.Common.DataColumnMapping("STA_Adresse2", "STA_Adresse2"),
                  new System.Data.Common.DataColumnMapping("STA_CLI_Id", "STA_CLI_Id"),
                  new System.Data.Common.DataColumnMapping("STA_CP", "STA_CP"),
                  new System.Data.Common.DataColumnMapping("STA_EMail", "STA_EMail"),
                  new System.Data.Common.DataColumnMapping("STA_ENF_Id", "STA_ENF_Id"),
                  new System.Data.Common.DataColumnMapping("STA_Fax", "STA_Fax"),
                  new System.Data.Common.DataColumnMapping("STA_Id", "STA_Id"),
                  new System.Data.Common.DataColumnMapping("STA_Mobile", "STA_Mobile"),
                  new System.Data.Common.DataColumnMapping("STA_Nom", "STA_Nom"),
                  new System.Data.Common.DataColumnMapping("STA_Prenom", "STA_Prenom"),
                  new System.Data.Common.DataColumnMapping("STA_Service", "STA_Service"),
                  new System.Data.Common.DataColumnMapping("STA_Suppression", "STA_Suppression"),
                  new System.Data.Common.DataColumnMapping("STA_Telephone", "STA_Telephone"),
                  new System.Data.Common.DataColumnMapping("STA_TIT_Id", "STA_TIT_Id"),
                  new System.Data.Common.DataColumnMapping("STA_Ville", "STA_Ville"),
                  new System.Data.Common.DataColumnMapping("STA_LAN_Id", "STA_LAN_Id"),
                  new System.Data.Common.DataColumnMapping("STA_Pays", "STA_Pays"),
                  new System.Data.Common.DataColumnMapping("LAN_Id", "LAN_Id"),
                  new System.Data.Common.DataColumnMapping("STA_GRP_ID", "STA_GRP_ID"),
                  new System.Data.Common.DataColumnMapping("GRP_ID", "GRP_ID"),
                  new System.Data.Common.DataColumnMapping("GRP_Nom", "GRP_Nom"),
                  new System.Data.Common.DataColumnMapping("LAN_Libelle", "LAN_Libelle")})});
      //
      // oleDbSelectCommand3
      //
      this.oleDbSelectCommand3.CommandText = @"SELECT STA_Stagiaire.STA_Adresse1, STA_Stagiaire.STA_Adresse2, STA_Stagiaire.STA_CLI_Id, STA_Stagiaire.STA_CP, STA_Stagiaire.STA_EMail, STA_Stagiaire.STA_ENF_Id, STA_Stagiaire.STA_Fax, STA_Stagiaire.STA_Id, STA_Stagiaire.STA_Mobile, STA_Stagiaire.STA_Nom, STA_Stagiaire.STA_Prenom, STA_Stagiaire.STA_Service, STA_Stagiaire.STA_Suppression, STA_Stagiaire.STA_Telephone, STA_Stagiaire.STA_TIT_Id, STA_Stagiaire.STA_Ville, STA_Stagiaire.STA_LAN_Id, STA_Stagiaire.STA_Pays, GRP_Groupes.GRP_Nom, LAN_Langue.LAN_Id, LAN_Langue.LAN_Libelle FROM ((STA_Stagiaire LEFT JOIN GRP_Groupes ON STA_Stagiaire.STA_GRP_ID = GRP_Groupes.GRP_Id) LEFT JOIN LAN_Langue ON STA_Stagiaire.STA_LAN_Id = LAN_Langue.LAN_Id) WHERE (STA_Stagiaire.STA_Suppression = 0) AND (STA_Stagiaire.STA_CLI_Id = ?)";
        this.oleDbSelectCommand3.Connection = this.DBConnATX;
      this.oleDbSelectCommand3.Parameters.Add(new System.Data.OleDb.OleDbParameter("STA_CLI_Id", System.Data.OleDb.OleDbType.Guid, 0, "STA_CLI_Id"));
      //
      // DAGroupes
      //
      this.DAGroupes.SelectCommand = this.oleDbSelectCommand5;
        this.DAGroupes.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "GRP_Groupes", new System.Data.Common.DataColumnMapping[] {
                  new System.Data.Common.DataColumnMapping("GRP_ID", "GRP_ID"),
                  new System.Data.Common.DataColumnMapping("GRP_CLI_ID", "GRP_CLI_ID"),
                  new System.Data.Common.DataColumnMapping("GRP_Nom", "GRP_Nom")})});
      //
      // oleDbSelectCommand5
      //
      this.oleDbSelectCommand5.CommandText = @"SELECT GRP_Groupes.GRP_ID, GRP_Groupes.GRP_Nom FROM GRP_Groupes WHERE GRP_Groupes.GRP_CLI_Id = ?";
        this.oleDbSelectCommand5.Connection = this.DBConnATX;
      this.oleDbSelectCommand5.Parameters.Add(new System.Data.OleDb.OleDbParameter("GRP_CLI_Id", System.Data.OleDb.OleDbType.Guid, 0, "GRP_CLI_Id"));
        
        //
      // DAClient
      //
      this.DAClient.SelectCommand = this.oleDbSelectCommand4;
      this.DAClient.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "CLI_Client", new System.Data.Common.DataColumnMapping[] {
            new System.Data.Common.DataColumnMapping("CLI_Adresse1", "CLI_Adresse1"),
            new System.Data.Common.DataColumnMapping("CLI_Adresse2", "CLI_Adresse2"),
            new System.Data.Common.DataColumnMapping("CLI_Convention", "CLI_Convention"),
            new System.Data.Common.DataColumnMapping("CLI_CP", "CLI_CP"),
            new System.Data.Common.DataColumnMapping("CLI_Denomination", "CLI_Denomination"),
            new System.Data.Common.DataColumnMapping("CLI_EMail", "CLI_EMail"),
            new System.Data.Common.DataColumnMapping("CLI_FAS_Id", "CLI_FAS_Id"),
            new System.Data.Common.DataColumnMapping("CLI_Fax", "CLI_Fax"),
            new System.Data.Common.DataColumnMapping("CLI_Id", "CLI_Id"),
            new System.Data.Common.DataColumnMapping("CLI_Mobile", "CLI_Mobile"),
            new System.Data.Common.DataColumnMapping("CLI_RaisonSociale", "CLI_RaisonSociale"),
            new System.Data.Common.DataColumnMapping("CLI_Reference", "CLI_Reference"),
            new System.Data.Common.DataColumnMapping("CLI_Site", "CLI_Site"),
            new System.Data.Common.DataColumnMapping("CLI_Suppression", "CLI_Suppression"),
            new System.Data.Common.DataColumnMapping("CLI_Telephone", "CLI_Telephone"),
            new System.Data.Common.DataColumnMapping("CLI_Ville", "CLI_Ville")})});
      //
      // oleDbSelectCommand4
      //
      this.oleDbSelectCommand4.CommandText = "SELECT CLI_Adresse1, CLI_Adresse2, CLI_Convention, CLI_CP, CLI_Denomination, CLI_" +
        "EMail, CLI_FAS_Id, CLI_Fax, CLI_Id, CLI_Mobile, CLI_RaisonSociale, CLI_Reference" +
        ", CLI_Site, CLI_Suppression, CLI_Telephone, CLI_Ville FROM CLI_Client WHERE (CLI" +
        "_Id = ?)";
      this.oleDbSelectCommand4.Connection = this.DBConnATX;
      this.oleDbSelectCommand4.Parameters.Add(new System.Data.OleDb.OleDbParameter("CLI_Id", System.Data.OleDb.OleDbType.Guid, 0, "CLI_Id"));
      this.Load += new System.EventHandler(this.Page_Load);
      ((System.ComponentModel.ISupportInitialize)(this.DS1)).EndInit();

    }
            #endregion


    private void DGStagiaires_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
      if ( (e.Item.ItemType == ListItemType.Item) ||
           (e.Item.ItemType == ListItemType.AlternatingItem) ||
           (e.Item.ItemType == ListItemType.SelectedItem) )
      {
        e.Item.Attributes.Add( "onmouseover", "hl();" );
        if ( e.Item.ItemType == ListItemType.AlternatingItem )
          e.Item.Attributes.Add( "onmouseout", "nha();" );
        else
          e.Item.Attributes.Add( "onmouseout", "nh();" );
        e.Item.Attributes.Add( "onclick", "edt();" );

        // adresse e-mail
        HtmlAnchor EMail = (HtmlAnchor)e.Item.Cells[5].Controls[1];
        EMail.HRef = "mailto:" +
          ((DataRowView)e.Item.DataItem).Row["STA_EMail"].ToString();
        EMail.InnerText = ((DataRowView)e.Item.DataItem).Row["STA_EMail"].ToString();

        // lien pour suppression
        HtmlAnchor BtnSuppr = (HtmlAnchor)e.Item.Cells[7].Controls[1];
        BtnSuppr.HRef = "suppression.aspx?tbl=sta&id=" +
          ((DataRowView)e.Item.DataItem).Row["STA_Id"].ToString() +
          "&cli=" + ((DataRowView)e.Item.DataItem).Row["STA_CLI_Id"].ToString();

        // attribut staid, pour d├ęclencher modif sur clic sur la ligne
        e.Item.Attributes["staid"] =
          ((DataRowView)e.Item.DataItem).Row["STA_Id"].ToString();
      }
    }

    private void DGStagiaires_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
    {
      DAStagiaires.SelectCommand.Parameters["STA_CLI_Id"].Value =
        new Guid( Request.QueryString["id"] );
      DAStagiaires.SelectCommand.CommandText += " ORDER BY " + e.SortExpression;
      DAStagiaires.Fill( DS1.STA_Stagiaire );
      DGStagiaires.DataBind();
    }
      

    private void DGGroupes_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
      if ( (e.Item.ItemType == ListItemType.Item) ||
           (e.Item.ItemType == ListItemType.AlternatingItem) ||
           (e.Item.ItemType == ListItemType.SelectedItem) )
      {
        e.Item.Attributes.Add( "onmouseover", "hl();" );
        if ( e.Item.ItemType == ListItemType.AlternatingItem )
          e.Item.Attributes.Add( "onmouseout", "nha();" );
        else
          e.Item.Attributes.Add( "onmouseout", "nh();" );
        e.Item.Attributes.Add( "onclick", "edt();" );

        // lien pour suppression
        HtmlAnchor BtnSuppr = (HtmlAnchor)e.Item.Cells[1].Controls[1];
        BtnSuppr.HRef = "suppression.aspx?tbl=grp&id=" +
          ((DataRowView)e.Item.DataItem).Row["GRP_Id"].ToString() +
          "&cli=" + ((DataRowView)e.Item.DataItem).Row["GRP_CLI_Id"].ToString();

        // attribut grpid, pour d├ęclencher modif sur clic sur la ligne
        e.Item.Attributes["grpid"] =
          ((DataRowView)e.Item.DataItem).Row["GRP_Id"].ToString();
      }
    }

      
         private void DGGroupes_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
    {
      DAGroupes.SelectCommand.Parameters["GRP_CLI_Id"].Value =
        new Guid( Request.QueryString["id"] );
      DAGroupes.SelectCommand.CommandText += " ORDER BY " + e.SortExpression;
      DAGroupes.Fill( DS1.STA_Stagiaire );
      DGGroupes.DataBind();
    }

      
      }
}
0
javilmer
Asked:
javilmer
  • 3
1 Solution
 
tinchosCommented:
Hi

the line you're getting the error is

            DAGroupes.Fill( DS1.GRP_Groupes );

DS1 is defined as
    protected ATX_FINALE.DSListeStagiaires DS1;

and the error you're getting is
 "does not contain a definition for GRP_Groupes"

The problem you're having is that DSListeStagiaires does not contain a property or member called GRP_Groupes.

So you're trying to pass as a parameter a property that does not exist.

Hope this helps

Tincho
0
 
javilmerAuthor Commented:
Hello,
thanks for this first explaination. What do you mean by DSListeStagiaires does not contain a property or member called GRP_Groupes ? How / where can I add this property ??
Thanks for help
0
 
tinchosCommented:
when you say

    protected ATX_FINALE.DSListeStagiaires DS1;


you're telling the compiler that DS1 is of type DSListeStagiarires

when you do
   this.DS1 = new ATX_FINALE.DSListeStagiaires();

you're creating that object

When you do

            DAGroupes.Fill( DS1.GRP_Groupes );

you're asking for the property or member GRP_Groupes

You should check class DSListeStagiaires in order to see if it has that property or method.

Tincho
0
 
tinchosCommented:
I guess the answer was fully answered.

Tincho
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now