Now You Can Have Robust Data Logging for Free – Part 11
HTML and Scripting Languages
- PLC program
- Visual Basic Program
- Data collected in a Database
- IIS web service established
Microsoft Access Database Engine 2010 Redistributable
Note: If you have office installed on your machine already, then you probably will already have this file.
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. The sample code below shows how to add this code to a web page.
You can download ADOVBS.inc from this site in text format. (Just rename to ADOVBS.inc from ADOVBS.txt)
ADO Introduction:
http://www.w3schools.com/asp/ado_intro.asp
Let’s set up ASP on IIS to display error messages to our browser.
Call up Control Panel and then go to Administrative Tools. Call up the Internet Information Services (IIS) Manager.
From IIS Manager, double-click on ASP under IIS. Expand Debugging Properties and change the Send Errors To Browser to True.
Let’s also ensure that your browser is set to display the error messages in internet explorer (IE). Call up Internet options from the main settings.
Click the setting for ‘Show friendly HTTP error messages.’ This will ensure that the error messages show up in your browser.
The last part of our project is to display the database information to the network. We do this by using a webpage. The HTML and VBScript can be written in any editor. (Like Notepad)
<html>
<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>
<!– #include virtual=”/adovbs.inc” –>
<%
Dim StartTime, EndTime
StartTime = Timer
Dim OBJdbConnection
Dim rs1
Dim objCmd
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
rs1.Open
arraytime = rs1.getrows()
rs1.close
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>”
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
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.