YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

How to use PI API in C# application? Options · View
maxim
#1 Posted : Thursday, June 10, 2010 7:06:58 PM
Rank: Member
Groups: Member

Joined: 6/10/2010
Posts: 16
Location: UK
Hello evey body!
i am new in PI system so i need a little bit help!!
How can use or connect pi api to c# application and how can i call a function?
I tried with dllimport but it doesn`t work!
So please help!
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Thursday, June 10, 2010 8:15:47 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Maxim,

Welcome to the forum!

Is there a particular reason why you are using PI-API instead of PISDK? You need a different licence from OSI to program using PI-API in your own applications over PI-API.
(I will dust off my PI-API .Net application examples...)

Cheers,

Rhys.

Principal Consultant
Real-Time Data Management @ Wipro Technologies
maxim
#3 Posted : Thursday, June 10, 2010 8:27:23 PM
Rank: Member
Groups: Member

Joined: 6/10/2010
Posts: 16
Location: UK
Hello!
Thanks for quick responding! So i am started to learn PI System so i decided you know to learn all about system!
So if i understand right api is included in sdk?
About license i have full!
anywhere do you have somethign or Are you remember how to connect to api?
and another question is there some examples application in c# or code?
RJK Solutions
#4 Posted : Thursday, June 10, 2010 9:13:11 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
OK at the very basic level, you would want something like the following to get you going in C#:

Code:

[DllImport("piapi32.dll")]
        public static extern Int32 piut_setservernode(String servername);

        [DllImport("piapi32.dll")]
        public static extern Int32 piut_login(String username, String password, out Int32 valid);

        static void Main(string[] args)
        {
            Int32 hresult = piut_setservernode("localhost");
            if (hresult == 0)
            {
                Int32 valid = 0 ;
                hresult = piut_login("", "", out valid);
            }

        }


However, I would recommend that you use PISDK instead. Smile
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.