- Posts: 17
- Thank you received: 1
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.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- How to retrieve a large array of data
How to retrieve a large array of data
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
>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.
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.
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.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- How to retrieve a large array of data