Re: Downloading Zip from SQL Image field

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

No idea if this is related or not, but in my office computer I have a
similar error, each time I select to download something from the internet
and select "open" instead of "save" I get the same error, but if I save it
first and open later I have no problem at all. I had no time to investigate
why is this happening, maybe the antivirus or a security policy.

Btw, the code seems fine , you did not post it how you are getting it from
the DB but it should be fine too.



--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"joef@xxxxxxxxxx" <joef@xxxxxxxxxx@discussions.microsoft.com> wrote in
message news:219717D8-0E58-4F1D-BD92-322A4D3AB6EF@xxxxxxxxxxxxxxxx
> I'm converting a Delphi app to C#. The application uploads and downloads
> files to an image field on SQL through a webservice. With Delphi, this was
> done straight to SQL instead of a webservice. The C# code works fine in
> both
> directions except in the case of zip files. I get a message, from WinZip,
> telling me that the archive is not valid. The zip is valid, in the sql
> server, becuase it can be opened when using my old Delphi version of this
> program. I can also upload the zips with the C# version and open them with
> the Delphi version so I'm pretty sure it how the file is being re-created
> using C#.
>
> Below is the code that I use to download and open the file Any help would
> be
> appreciated.
>
> TIA
>
> //Get the document from the table
> DataRow rowDataImage = null;
> DataRowView rowData =
> DataRowView)BindingContext[dsLibrary.Tables["AvailDocs"]].Current;
> DataSet ds = DB.getDoc(System.Convert.ToInt32(rowData[0].ToString()));
> string strDocExt =
> DB.getDocFileExt(System.Convert.ToInt32(rowData[0].ToString()));
> rowDataImage=ds.Tables[0].Rows[0];
>
> //Read the image from the table field into a byte array
> byte[] MyData= new byte[0];
> MyData = (byte[])rowDataImage[0];
> int ArraySize = new int();
> ArraySize = MyData.GetUpperBound(0);
>
> //Create a destination for the file
> FileStream fs = new FileStream("c:\\elibtemp." + strDocExt,
> FileMode.Create,FileAccess.Write,FileShare.Write,ArraySize,true);
>
> // Create the writer for data.
> fs.Write(MyData, 0,ArraySize);
> fs.Close();


.



Relevant Pages

  • Re: Stop the negativism!
    ... believe that anything close to a majority of existing customers participate ... They have numbers on registrations, on support calls, on ... They also have counts on how many read BDN articles or download sample code ... take a look at all the Delphi .Net articles in Code ...
    (borland.public.delphi.non-technical)
  • Re: Any news on ESD->ISO? (for Nick Hodges)
    ... Australian site doesn't allow the purchase of the media kit by itself. ... My core concern is that the digital river site says the download is only ... So the clock is ticking for me to make a backup. ... What I need is some way to reinstall Delphi 2007 if for some reason my PC ...
    (borland.public.delphi.non-technical)
  • Delphis BorlndMM.dll vs FastMMs replacement
    ... I've been noticing that a few people tend to download and run ... Memory Manager that comes with Delphi. ... They hang under IDE ... Compatibility Checker - a standalone utility compiled to full ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: what is your favorite news reader?
    ... The source code for XanaNews is in a separate download. ... Delphi 5 would be tricky. ... So maybe easiest way to compile it would be to get the Personal edition ...
    (borland.public.delphi.non-technical)
  • Re: WINSSH.EXE and WINSRT.EXE SQL Virus
    ... | SQL v7 or SQL 2000. ... * propagates to machines vulnerable to the following exploiting RPC/RPCSS DCOM and LSASS ... You need to downlaad the following tool to all infected computers and download the needed ... This will bring up the initial menu of choices and should be executed in Normal Mode. ...
    (microsoft.public.security.virus)