Now You Can Have Robust Data Logging for Free – Part 12
HTML and Scripting Languages
- PLC program
- Visual Basic Program
- Data collected in a Database
- IIS web service established
- ASP Script Written
<head>
<meta HTTP-EQUIV=”Refresh” CONTENT=”300″>
<title>ACC Automation – Robust Logger</title>
<LINK REL=”SHORTCUT ICON” HREF=”http://192.168.1.3/ACC_Do.ico”/></head>
ActiveX Data Objects (ADO) access databases from your web pages. ADOVBS.inc is a file that has all of the ADO constants defined. Be sure to add this file to your root web application directory.
<!– #include virtual=”/adovbs.inc” –>
The <% and %> symbols indicate the start and finish of the VBScript on the page. We dimension our variables for StartTime and EndTime. These will be used to determine how long our script took to execute.
<%
Dim StartTime, EndTime
StartTime = Timer
We dimension the variables used for the connection to the database file.
Dim OBJdbConnection
Dim rs1
Dim objCmd
We set up the connection to the database and determined what information we needed to retrieve.
Set OBJdbConnection = Server.CreateObject(“ADODB.Connection”)
OBJdbConnection.Open “Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=C:\AccRL\data\AccRL.accdb;Persist Security Info=False;”
set rs1 = Server.CreateObject(“ADODB.recordset”)
with rs1
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.CursorLocation = adUseServer
.ActiveConnection = OBJdbConnection
.Source = “SELECT * FROM Minute_Log;”
end with
Using getrows will allow us to execute the Select command and retrieve all the information from the database in one pass. This is the quickest method to get the information out quickly.
rs1.Open
arraytime = rs1.getrows()
rs1.close
We now write the information from the database to the page.
Response.Write arraytime(0,0) & “<br>”
Response.Write arraytime(1,0) & “<br>”
Response.Write Year(arraytime(1,0))& “/” & Right(“0” & Month(arraytime(1,0)), 2) & “/” & Right(“0” & Day(arraytime(1,0)), 2) & “<br>”
Response.Write arraytime(2,0)& “<br>”
Response.Write arraytime(3,0)& “<br>”
Response.Write arraytime(4,0)& “<br>”
The EndTime is now set, and the total time it took for the process is displayed.
EndTime = Timer
Response.write “<p>Processing took “&(EndTime-StartTime)&” seconds<p> ”
%>
</body>
</html>
Regards,
Garry
Now You Can Have Robust Data Logging for Free – Part 1
Now You Can Have Robust Data Logging for Free – Part 2
Now You Can Have Robust Data Logging for Free – Part 3
Now You Can Have Robust Data Logging for Free – Part 4
Now You Can Have Robust Data Logging for Free – Part 5
Now You Can Have Robust Data Logging for Free – Part 6
Now You Can Have Robust Data Logging for Free – Part 7
Now You Can Have Robust Data Logging for Free – Part 8
Now You Can Have Robust Data Logging for Free – Part 9
Now You Can Have Robust Data Logging for Free – Part 10
Now You Can Have Robust Data Logging for Free – Part 11
Now You Can Have Robust Data Logging for Free – Part 12
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.