G
Graham James Campbell CS2000
Having a nightmare problem with this and would appreciate any and all help.
The situation is I want to move from a webform and format the user
inputted text into some html I am storing in a template file on my server.
I have to admit to being entirley new to ASP and so much of what follows
is probably absolute nonsense.
<%
Option Explicit
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Class Test
Public Sub Main()
Try
' Create an instance of StreamReader to read from a ' file.
Dim sr, sw
Dim filename, openText, apologiesText, treasurerText,
secretaryText, commentsText
'creates the filename
theMonth = Request.Form("month")
theYear = Request.Form("year")
filename = ""&theMonth&""&theYear&".txt"
sr = New StreamReader("minutesTemplate.txt")
sw = New StreamWriter(filename)
Dim line As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line = sr.ReadLine()
'this case statement is going to need some 'refining.
Select Case line
Case "---Opening Comments---"
openText=Request.Form("open")
sw.write(openText)
Case "---Apologies---"
apologiesText=Request.Form("apologies")
sw.write(apologiesText)
Case "---Treasurer Report---"
treasurerText=Request.Form("treasurer")
sw.write(treasurerText)
Case "---Secretary Report---"
secretaryText=Request.Form("secretary")
sw.write(secretaryText)
Case "---Additional Comments---"
commentsText=Request.Form("comments")
sw.write(commentsText)
Case else
break
End Select
Loop Until line Is Nothing
sr.Close()
sw.Close()
Catch E As Exception
' Let the user know what went wrong.
'Console.WriteLine("The file could not be read:")
'Console.WriteLine(E.Message)
End Try
End Sub
End Class
%>
The error message I'm getting at the moment is
Microsoft VBScript compilation error '800a0401'
Expected end of statement
sr = New StreamReader("minutesTemplate.txt")
---------------------^
As before, any help would be great!
Thanks
Graham
The situation is I want to move from a webform and format the user
inputted text into some html I am storing in a template file on my server.
I have to admit to being entirley new to ASP and so much of what follows
is probably absolute nonsense.
<%
Option Explicit
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Class Test
Public Sub Main()
Try
' Create an instance of StreamReader to read from a ' file.
Dim sr, sw
Dim filename, openText, apologiesText, treasurerText,
secretaryText, commentsText
'creates the filename
theMonth = Request.Form("month")
theYear = Request.Form("year")
filename = ""&theMonth&""&theYear&".txt"
sr = New StreamReader("minutesTemplate.txt")
sw = New StreamWriter(filename)
Dim line As String
' Read and display the lines from the file until the end
' of the file is reached.
Do
line = sr.ReadLine()
'this case statement is going to need some 'refining.
Select Case line
Case "---Opening Comments---"
openText=Request.Form("open")
sw.write(openText)
Case "---Apologies---"
apologiesText=Request.Form("apologies")
sw.write(apologiesText)
Case "---Treasurer Report---"
treasurerText=Request.Form("treasurer")
sw.write(treasurerText)
Case "---Secretary Report---"
secretaryText=Request.Form("secretary")
sw.write(secretaryText)
Case "---Additional Comments---"
commentsText=Request.Form("comments")
sw.write(commentsText)
Case else
break
End Select
Loop Until line Is Nothing
sr.Close()
sw.Close()
Catch E As Exception
' Let the user know what went wrong.
'Console.WriteLine("The file could not be read:")
'Console.WriteLine(E.Message)
End Try
End Sub
End Class
%>
The error message I'm getting at the moment is
Microsoft VBScript compilation error '800a0401'
Expected end of statement
sr = New StreamReader("minutesTemplate.txt")
---------------------^
As before, any help would be great!
Thanks
Graham