rodolfome

Problem with C# Dev and AF/PISdk

Discussion created by rodolfome on Oct 31, 2014
Latest reply on Nov 3, 2014 by Marcos Vainer Loeff

Hi,

 

I'm starting to develop web apps, using AF/PISDK.

 

I developed one application to manage AF Tree Structure and PI Tags... with this application, i can create, delete, edit PITags and AF Elements.

 

So... when i use... my application, i create some nodes, and tags... and suddenly... my app raise this error:

Database 'XXX' has been disconnected. This is caused by using an object from a database after calling PISystem.Disconnect.


Here is my code to connect to AFServer. I connect Allways before create one new AFElement.
 

 
       public bool AFConnect()
        {
            if (!this.AFSystem.ConnectionInfo.IsConnected)
            {
                try
                {
                    AFSystem.Connect(this.NWCredential);
                    AFDb = AFSystem.Databases[WebConfigurationManager.AppSettings["AFDb"]];
                    this.mapTemplates();
                    return true;
                }
                catch (Exception e)
                {
                    return treatExceptions(e);
                }
            }
            else
            {
                return true;
            }
        }

 
When i start the application, It works perfectly... i can create 3 or 4 nodes... before the application raises the error.

Can anyone help me ?!

(Sorry about the poor English).

Outcomes