
July 7th, 2012, 11:25 AM
|
|
|
I don't know if your server supports ASP code, but the following demonstrates how a web page would append to a text file on the server using ASP. In this case, the server is taking comma separated SQL string information sent to it using a "Post" function and adds it to a text file. Another program periodically polls the file, recovers the SQL data, adds it to a database, and deletes the line. Logfile entries would be simpler and would not utilize the "Post" function, but you get the idea.
J.A. Coutts
Code:
<html>
<body>
<form action="mantapost.asp" method="post">
<input type="text" name="query">
</form>
<%
Dim ObjFSO
Dim objFile
If Request.Form<>"" Then
Response.Write("Requested: " & Now & "<br>")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(Server.MapPath("..\..\..\MantaData\Query.sql"), 8)
objFile.WriteLine(Request.Form)
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Response.Write("Processed: " & Now)
End If
%>
</body>
</html>
|