About PI-API Error -10401

Thursday, November 30, 2006

Today I wanted to insert data to PI by using a .net class which boxed PI-API I created it before. I used function pisn_putsnapshotx, but it doesn't work with error code -10401.

In PI_API Documents, there is no comment about this error code. so I had to found the reason by myself. I used default point "sinusoid" as test point and try to insert data into it. it works Fine. Then I compare tag property of "sinusoid" and my problem tag, I notice defference on DataAccess.

sinusoid: o:rw g:rw w:rw Problem tag: o:rw g:r w:r

OK, I guess this is the reason, I chaged Problem tag's property to o:rw g:rw w:rw, then I use pisn_putsnapshotx function to insert data, works well.

So error code -10401 is a access level problem.

there is two way to solve it now.

1. As said above, change property to o:rw g:rw w:rw.

2. Add login information in your code by using pilg_login or piut_login

PS: I can't use pilg_login because no entry point in piapi32.dll when I P/Invoke it. I do not know why. But I found piut_login is always OK.

more article about PI development visit My Former Chinese Techinical Blog!