Creating a File

Results 1 to 2 of 2

Thread: Creating a File

  1. #1
    Join Date
    Dec 1969

    Default Creating a File

    I want to create a file using asp here is the code. It will write out the response but won&#039;t write the file. Is there something wrong with the code?<BR><BR>strSql = "Select " & sqlname & " From tblcomps Where " & criteria & " LIKE &#039;%" & schkywrds & "%&#039;"<BR>Set objRec = Server.CreateObject("ADODB.Recordset")<BR>objRec.O pen strSql, strconn, 3, 3<BR> <BR>wrtefile = "C: estingfile.txt"<BR> <BR>Set objFso = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>Set objFile = objFso.CreateTextFile(wrtefile, True)<BR><BR>Do While (not objRec.Eof)<BR>strValues=""<BR>For intI=0 To objRec.Fields.Count-1<BR>If intI=0 Then <BR>strValues=strValues & objRec.Fields(intI)<BR>Else<BR>strValues=strValues "," & objRec.Fields(intI)<BR>End If<BR>Next<BR>objFile.WriteLine(strValues)<BR>objR ec.MoveNext<BR>Loop<BR><BR>objFile.Close<BR>objRec .Close<BR>Set objFile=Nothing<BR>Set objFso=Nothing<BR>Set objRec=Nothing

  2. #2
    Join Date
    Dec 1969

    Default RE: Creating a File

    i can&#039;t se anythign wrong with your code, file permission maybe (although you have already thought about that..), just try writing the file (with out the databse stuff) and see if that works. then you&#039;ll have something to go on

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts