ADODB Stream object errors

Results 1 to 2 of 2

Thread: ADODB Stream object errors

  1. #1
    Join Date
    Dec 1969

    Default ADODB Stream object errors

    Hi I&#039;m trying to open a jpeg image file for download through an ASP (for security reasons) and I found that I had to use the Stream object to open binary files. <BR><BR>So I attempted this, using code I found on the microsoft site and also this site (4GuysFromRolla - article and neither code works. The code I&#039;m currently trying is: <BR><BR>&#039;Create a Stream instance <BR>Dim objStream <BR>Dim output <BR>Set objStream = Server.CreateObject("ADODB.Stream") <BR><BR>&#039;Open a jpg photo file <BR>objStream.Type = adTypeBinary <BR>objStream.Open "C:photosimage.jpg",adModeRead <BR><BR>output = objStream.Read(adReadAll) <BR><BR>&#039;Output the contents of the stream object <BR>Response.AddHeader "Content-Disposition", "attachment;filename=image.jpg" <BR>Response.BinaryWrite output <BR><BR>Both the following lines give the same error (I have tried commenting out one at a time): <BR><BR>objStream.Type = adTypeBinary <BR>objStream.Open "C:photosimage.jpg",adModeRead <BR><BR>This error is: <BR><BR>"ADODB.Stream error &#039;800a0bb9&#039; <BR><BR>Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. <BR><BR>?" <BR><BR>Does anyone know why I&#039;m getting this error? I have ADO 2.6 on my machine.

  2. #2
    Join Date
    Dec 1969

    Default Did you include

    You are using constants--adTypeBinary and adModeRead--that are defined in If you didn&#039;t include that file, then it&#039;s not defined, so it&#039;s the same as using zero for those arguments.<BR><BR>If you don&#039;t know about or don&#039;t understand, check the ASPFAQs (link at top right of this page), I believe in category "The Nature of Things".<BR><BR><BR>

Posting Permissions

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