View Single Post
Old 01-29-2013, 06:50 PM   PM User | #1
Catch84
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Catch84 is an unknown quantity at this point
Is Ajax right for me?

What I have works (kind of) but I am looking for a better way. What I have is an FTP script that runs every few minutes and gathers small .txt files from 5 different locations. I then use this to present that information.

Code:
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")

strPathtoTextFile = "C:\Inetpub\wwwroot\Default\new_web\usbobs\"

objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & strPathtoTextFile & ";" & _
          "Extended Properties=""text;HDR=No;FMT=Delimited"""

strFile = "cf.txt"

objRecordset.Open "SELECT * FROM cf.txt",_
          objConnection, adOpenStatic, adLockOptimistic, adCmdText

count = 4
do until count = 0



'Do Until objRecordset.EOF
       
  
 If objRecordset.Fields.Item("BobNumber") = "East Plytrim" Then Response.Write "<span style=""color: rgb(51,0,102);"">Bin: East Plytrim</span>" & "<br>"
 If objRecordset.Fields.Item("BobNumber") = "Center Plytrim" Then Response.Write "<span style=""color: rgb(51,0,102);"">Bin: Center Plytrim</span>" & "<br>"
 If objRecordset.Fields.Item("BobNumber") = "Saw Chips" Then Response.Write "<span style=""color: rgb(51,0,102);"">Bin: Saw Chips</span>" & "<br>"
 If objRecordset.Fields.Item("BobNumber") = "Plychips" Then Response.Write "<span style=""color: rgb(51,0,102);"">Bin: Plychips</span>" & "<br>"
	If objRecordset.Fields.Item("BinMeasure") >= 17 Then Response.Write "<span style=""color: red; font-weight:bold;"">High Level</span>" & "<br>"
    Response.Write "<span style=""color: rgb(0, 255, 255); font-weight:bold;"">Height: </span>" & "<span style=""color: rgb(0, 255, 255); font-weight:bold;"">" & objRecordset.Fields.Item ("percentage") & "</span>" & "<br>"
    If objRecordset.Fields.Item("Status") = "DISABLED" Then Response.Write "<span style=""color: red; font-weight:bold;"">Status: DISABLED</span>" & "<br>"
    If objRecordset.Fields.Item("Status") = "ENABLED" Then Response.Write "Status: ENABLED" & "<br>" 
    Response.Write "Status: " & objRecordset.Fields.Item("DateTime") & "<br>"
    Response.Write "<br>"


objRecordset.MoveNext

count = count - 1
 
Loop

objRecordset.close
I also use <meta http-equiv="refresh" content="300"> to refresh the browser every 5 min, but I'm sure this is not the best way to accomplish this. Would Ajax be the right way to go and if so could someone give me a shove in the right direction?
Catch84 is offline   Reply With Quote