-
total newbie (asp into existing html page)
I know absolutely nothing about ASP.
I had a page writen for OPC communication in HTML that worked for me, but now I'm being told that I need to use ASP instead. Can anybody tell me how to make the below HTML page work with the (more) below ASP tags?
Thanks!
---------------
HTML
---------------
<HTML>
<head>
<title>OPC Web Client Example, Single Tag Read Within IE</title>
</head>
<body>
<input type="button" value="Get readings" name="B3" onClick="doRead();"><br>
Signal Quality: <input type="text" name="T1" size="20">
</body>
<script language="javascript">
function doRead()
{
try
{
var opcWebClient = new ActiveXObject("OPCLabs.EasyDA3.0");
var valueTimeQuality = opcWebClient.ReadItem("74.208.99.113", "M2MOPC.OPC.1",
"MSC:[MobilFoamSafe1]SignalQuality", "", 0)
document.all.T1.value = valueTimeQuality.Value;
}
catch(e)
{
alert(e)
}
}
</script>
</HTML>
-------------
ASP
-------------
Try
Dim objOWC As New OPCLabs.EasyOPCDANet.EasyDACOM
Dim objVTQ As VTQ3 = objOWC.ReadItem ("74.208.99.113", _ 'Computer IP where the OPC Server resides
"M2MOPC.OPC.1", _ 'OPC Server Prog ID
"MSC:[MobilFoamSafe1]SignalQuality") 'Tag name
Response.Write("Value:" & objVTQ.Value & "<br>")
Response.Write("Qlty:" & objVTQ .Quality & "<br>")
Response.Write("Time:" & objVTQ .TimeStamp & "<br>")
Catch ex As Exception
Response.Write("Error: " & ex.Message)
End Try
-
-
There's no Try and Catch in ASP, use "On Error Resume Next". Try and Catch statements are available in asp.net only! ASP is just VBScript. You cannot also use the Dim As Statement here's a sample code to create an instance of a COM Object:
<%
Dim objOWC
Set objOWC = Server.CreateObject("OPCLabs.EasyOPCDANet.EasyDACOM")
%>
Last edited by kooshal; 01-15-2008 at 08:54 AM.
Reason: Changes needed
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks