Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

How to retrieve a large array of data

More
02 Nov 2012 16:13 #1076 by tlaford
I am using Visual Studio 2008 (Visual Basic) and the project is set to target .NET Framework 3.5.

Please Log in or Create an account to join the conversation.

More
02 Nov 2012 16:07 #1074 by support
Are you building with VS 2010 or VS 2008? If VS 2010 and for .NET Framework 4.0, try switching the project (in its Properties) to target .NET Framework 3.5.

Please Log in or Create an account to join the conversation.

More
02 Nov 2012 15:15 #1073 by tlaford
Yes - the problem still occurs.
I even tried copying my EasyOpcNetDemo.exe into the same directory as the official "Demo Application (.NET)" and the problem still occurs.

Please Log in or Create an account to join the conversation.

More
02 Nov 2012 15:09 #1072 by support
If you build it in Visual Studio, but then start the resulting .EXE, do youstill get Access denied?

Please Log in or Create an account to join the conversation.

More
02 Nov 2012 14:19 #1071 by tlaford
Thank you for your quick reply.
>1) Find a source of the demo app, rebuild and retest. It is available both in C# and VB in the Examples solution.

OK. I copied it to another directory (I do not want to change the original code) and I changed the text fields to default to my values - I have not yet changed anything else. When I run from Visual Studio the GUI appears and when I click on the SUBSCRIBE ITEM button the Exception text box says "Access is denied."
But when I re-run the official "Demo Application (.NET)" it works fine and shows "System.Single[]"
What am I forgetting to do when I build and run in Visual Studio?

Please Log in or Create an account to join the conversation.

More
01 Nov 2012 20:03 #1069 by support
Alright, there are multiple things in your post, let's start from where it seems easiest. The Demo application actually appears to be working, so your best bet is to take it and gradually modify it to your needs.
The fact that it displays "System.Single[]" is actually a good sign. It means that 1) the read was successfil, and 2) it returned an array of 4-byte floats. The only issue here is that the .ToString() does not know how to convert arrays to actually readable strings of values.
I suggest that you do this:
1) Find a source of the demo app, rebuild and retest. It is available both in C# and VB in the Examples solution.
2) Split the line that assigns into a textbox into two or three statements; first read into an 'Object', then do .ToString into a temp string variable, then finally assign to the textbox.
3) Use a debugger to inspect the value right after reading - in the Object, before conversion .ToString(). The debugger should show you the array of values with their actual values.
4) Replace .ToString with a loop that'll convert the individual array elements into a string
That should do it. I do not know exactly at this moment why the other approach (starting with Quick Start) does not work, it could be DCOM problem, but let's leave this aside for now and just focus on the part that works in principle.
If you get into problems, let me know and I will try to help.
Best regards,

Please Log in or Create an account to join the conversation.

More
01 Nov 2012 19:45 #1068 by tlaford
I have modified the one line Quick Start example to access my own OPC Server:
textbox1.Text = EasyDAClient1.ReadItemValue("MyOpcServer",
"aaaaa.bbbbb.1", "CcC.DdD.EeE.FfF.GgG HhH.IiI.Data").ToString()
The data I am trying to read is an array of over 500 numbers.
When I run, I get the following error:
OpcLabs.EasyOpc.OpcException: OPC operation failure. ---> System.Runtime.InteropServices.COMException (0x80040200): Unknown error. --- End of inner exception stack trace --- at OpcLabs.EasyOpc.OperationResult.ThrowIfFailed() at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItemValue(ServerDescriptor serverDescriptor, DAItemDescriptor itemDescriptor) at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItemValue(String machineName, String serverClass, String itemId, VarType dataType) at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItemValue(String machineName, String serverClass, String itemId) at _Default.Page_Load(Object Sender, EventArgs e) in C:\MyTool\Default.aspx.vb:line 48
When I activate the "Demo Application (.NET)" and specify "MyOpcServer" as my Machine name, "aaaaa.bbbbb.1" as my Server class, and "CcC.DdD.EeE.FfF.GgG HhH.IiI.Data" as my Item ID and click on the SUBSCRIBE ITEM button, the VALUE field displays "System.Single[]".
I have also tried to assign the value to an Object, but the same exception occurred:
Dim val As Object
val = EasyDAClient1.ReadItemValue(...)
Can someone please enlighten me as to what I need to change in my Visual Basic code to read this array?

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.052 seconds