born2program
Technical User
I have the following code written in vb.net behind a asp.net page. It errors (Invalid Cast) out on the line fstr = fs
penTextFile(fname, 2, Not fso.FileExists(fname)). Any help will be appreciated.
Code:
Dim fso As Object
Dim fstr As StreamWriter
Dim qbTranHdr As String
Dim qbSplHdr As String
Dim qbEndTranHdr As String
Dim qbTran As String
Dim qbSpl As String
Dim qbEndTran As String
Dim fname As String
fname = "C:\TestQuick.iif"
fso = Server.CreateObject("Scripting.FileSystemObject")
fstr = fso.OpenTextFile(fname, 2, Not fso.FileExists(fname))
qbTranHdr = "!TRNS" & vbTab & "TRNSID"
qbSplHdr = "!SPL" & vbTab & "SPLID"
qbEndTranHdr = "!ENDTRANS"
qbEndTran = "ENDTRNS"
fstr.Write(qbTranHdr & vbNewLine)
fstr.Write(qbSplHdr & vbNewLine)
fstr.Write(qbEndTranHdr & vbNewLine)
qbTran = "TRNS" & vbTab & " " & "BILL"
fstr.Write(qbTran & vbNewLine)
qbSpl = "SPL" & vbTab & " " & vbTab & "BILL"
fstr.Write(qbSpl & vbNewLine)
fstr.Write(qbEndTran & vbNewLine)
qbTran = ""
qbSpl = ""
fstr = Nothing
fso = Nothing