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 use EasyOpcLib in SQLCLR

More
31 Jan 2013 07:38 #1208 by support
Oh, I see now, please drop my recent post. I realized it from your other question: You are not really using QuickOPC.NET assemblies, you are using Interop to QuickOPC-COM. That's the approach that works, but it somewhat clumsy in terms of typecasting needed, as I will explain in the answer to your other questions.
I got confused because your questions are in the QuickOPC.NET forums (yes I understand, because SQLCLR is a .NET host), but from our perspective, it is QuickOPC-COM product and component that you are using.

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

More
31 Jan 2013 07:25 #1207 by support
May I ask you whether/how you have managed to get EasyDAClient working in SQLCLR? Because, if I remember well, when we attempted that, we ran into problems with the fact there are internal assemblies that are mixed-mode (contain native code), and SQL server refused to load them.

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

More
30 Jan 2013 17:43 #1206 by rdprecure
Thank you, that is helpful. I will check for other errors as I build this component.

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

More
30 Jan 2013 16:58 #1203 by support
Hello.
We do not have dedicated methods to check the validity. But there are specific error codes returned in such cases. You already know the error code for an invalid OPC server class :-). Then, there are two such errors for invalid OPC items: One is when the syntax is totally invalid, and one is when the syntax is valid but still the item does not exist. The codes for this are:
//
// MessageId: OPC_E_UNKNOWNITEMID
//
// MessageText:
//
// The item ID is not defined in the server address space or no longer exists in the server address space.
//
#define OPC_E_UNKNOWNITEMID ((HRESULT)0xC0040007L)

//
// MessageId: OPC_E_INVALIDITEMID
//
// MessageText:
//
// The item ID does not conform to the server's syntax.
//
#define OPC_E_INVALIDITEMID ((HRESULT)0xC0040008L)

Why do you want to specifically test these? (because there are other kind of errors that can also cause failures). Also note that the component does re-tries automatically (this is mainly relevant with subscriptions; if you pass in an invalid info, it may become valid, such as in case of server reconfiguration; but you do not have to put in the retrial logic, it's all handled internally by QuickOPC).

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

More
30 Jan 2013 15:52 #1202 by rdprecure
A follow up...
What is the best way to check for an OPC server or an item name that does not exist?

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

More
30 Jan 2013 15:48 #1201 by rdprecure
Holy crap! How many times did I look right at it and not see it. I guess I tried to make it too complicated. Now I'm ashamed to call myself a developer. Thank you very much.

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

More
30 Jan 2013 14:44 #1200 by support
You have a typo. It is not "OPCLabs.Kiterver.2", it should be "OPCLabs.KitServer.2".
Kind regards,
Zbynek Zahradnik

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

More
30 Jan 2013 14:21 #1199 by rdprecure
Hello,
I am trying to create a user-defined-function that I can call from a SQL stored procedure. The code for the function is as follows:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports OpcLabs.Interop.EasyOpcLib
Partial Public Class UserDefinedFunctions
_
Public Shared Function ReadTrends() As Single
Dim opc As New EasyDAClient
Dim valu As Single
valu = opc.ReadItemValue("", "OPCLabs.Kiterver.2", "Trends.Ramp (1 s)")
Return valu
End Function
End Class
When I attempt to call the function from SQL I get the following error:
A .NET Framework error occurred during execution of user-defined routine or aggregate "ReadTrends":
System.Runtime.InteropServices.COMException: Invalid class string
System.Runtime.InteropServices.COMException:
at OpcLabs.Interop.EasyOpcLib.EasyDAClientClass.ReadItemValue(Object varMachineName, Object varServerClass, Object varItemId, Object varDataType, Object varAccessPath)
at OxyOPCAssembly.UserDefinedFunctions.ReadTrends()
Can anyone help me with this? Thank you.

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

Moderators: support
Time to create page: 0.053 seconds