1 Reply Latest reply on Jul 27, 2015 1:41 PM by Dan Fishman

    Getting 'object' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) error while retreiving PI tag values from PI

    shekar

      Hi Team,

       

      When I try to get tag values from PI SDK through following below method

       

      using System;

      using System.Collections.Generic;

      using System.Linq;

      using System.Web;

      using System.Web.UI;

      using System.Web.UI.WebControls;

      using System.Web.UI.HtmlControls;

      using System.Data.OleDb;

      using System.Data;

      using System.Data.SqlClient;

      using CommonAvailabiltyStatus;

      using System.Text;

      using PISDK;

      using PISDKCommon;

       

      public string getEndtimeOrEndtimePreviousTagValue(string strTagName, DateTime dtEndTime)

              {

                  string strEndtimeOrPreviousTagValue = "";

                  PISDK.PIData myPIdata;

                  PISDK.Server piServer;           

                  PITimeServer.PITimeFormat formatToCall = new PITimeServer.PITimeFormat();

                 

                  try

                  {

                      PISDK.PISDK _pisdk = new PISDK.PISDK();

                      piServer = _pisdk.Servers["E20052000"];

                      piServer.Open("");

                      PISDK.PIPoint mypoint = piServer.PIPoints[strTagName];

                      myPIdata = mypoint.Data;

                      //formatToCall.TimeZoneInfo = piServer.PITimeZoneInfo;

                      //formatToCall.InputString = string.Format("{0}", dtEndTime);

                      PISDK.PIValue Tagvalue = mypoint.Data.ArcValue(dtEndTime, PISDK.RetrievalTypeConstants.rtAtOrBefore);

                      if (Tagvalue.Value.Name != "No Data")

                          strEndtimeOrPreviousTagValue = Tagvalue.Value.Name;

                  }

                  catch (Exception ex)

                  {

                      lblError.ForeColor = System.Drawing.Color.Red;

                      lblError.Text = ex.Message.ToString();

                  }

                  finally

                  {

                      piServer = null;

                  }

                  return strEndtimeOrPreviousTagValue;

              }

       

      I am getting above error at line 'Tagvalue.Value.Name'

       

      Anyone can suggest what I am missing.

       

      thanks

      Madhu