Writing to a file

A

Andrew Chalk

Can I write to a binary file from a VB script?

I get a syntax error:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/Web2_Local/custquery.asp, line 180, column 21
Open "DOWNLOAD.FIL" For Binary Access Write As #1


Many thanks.
 
R

Ray at

About the FSO:
"Although it does not yet support the creation or manipulation of binary
files, future support of binary files is planned."

What are you trying to do?

Ray at home
 
A

Andrew Chalk

When the user click a specific button, I perform a database lookup and then
format the returned data into a binary file. I write that to disk and pop up
the "file download" dialog so that the user can d/l the file.

I am assuming that because the file I create can contain arbitrary data, it
should be what VB calls a "binary" file. Although I don't know. A so-called
"text file" may work.

Regards.
 
R

Ray at

T

Tom B

Is the actual data in the database? If so you can use ado to stream it from
the database to the user.
Is the filename in the database? If so you can just link to the file, or use
FSO, to copy the file to a temporary location.
 
A

Andrew Chalk

Good points Tom. In this case actual raw data is in the database. However,
the file I write contains that data transformed to comply with an external
specification. Therefore, I can't stream it.

Regards.
 
A

Andrew Chalk

Response.Clear removes most of the extraneous bytes -- but still leaves

<!--METADATA TYPE="ASP_DEBUG_INFO"
-->

at the beginning.
 
R

Ray at

In your IIS manager, pull up the properties of your site, or your
application. Home directory tab. Configuration (under application
settings). App debugging tab. Uncheck the debugging options.

That's my guess, anyway.

Ray at home
 
A

Andrew Chalk

Found the problem! I was running in debug mode within VI 6.0. That puts the
header there and it can't be removed. Run it from localhost, or whatever,
and the header disappears.

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top