さまざまなページの入力要素から収集されたデータを後で使用するために、単純にテキスト ファイルに書き込もうとしています。確かに、明らかなことを見逃している可能性がありますが、試したバリエーションや、多くの例で見つけたサンプルコードのいくつかでさえ、常に同じエラーが発生します。
コード:
<%
  Dim currentDirectoryPath, outFile, objFSO, objTextStream
  Const fsoForWriting = 2
  'Get and assign current directory path
  currentDirectoryPath = Server.MapPath(".")
  'Assign file name to be used
  outFile = "\accdata.txt\"
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  'Open the text file
  Set objTextStream = objFSO.OpenTextFile(currentDirectoryPath & outFile, fsoForWriting, True)
  'Write new line to text file
  objTextStream.WriteLine "output this as one line of text"
  'Close the file and clean up
  objTextStream.Close
  Set objTextStream = Nothing
  Set objFSO = Nothing
%>
結果:
Microsoft VBScript ランタイム エラー '800a0034'
ファイル名または番号が正しくありません
/asp/accounting/datacollect.asp、23 行目
(コードの 23 行目:)
Set objTextStream = objFSO.OpenTextFile(currentDirectoryPath & outFile, fsoForWriting, True)
これは私の最初の言語とはほど遠いので、私はそれについて多くの経験を積んでいないので、どんな助けや提案も大歓迎です.