Re: NorthWind Database, can't view images

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



On 1 jun, 02:49, "Cor Ligthert[MVP]" <notmyfirstn...@xxxxxxxxx> wrote:
JP,

In the Northwind datatabase are Ole bytes array included.
To get the images you need an offset of 78 bytes.

Whatever.Write(ByteArray, 78, ByteArra.Length - 78)

Cor

"JP" <j.pablobla...@xxxxxxxxx> schreef in berichtnews:93041740-fd59-44ab-b71f-89e071275338@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In the table Employees of NorthWind database there is a column Photo
(data type: image). I want to convert the first row image into a jpg
file, but I can't open the file because is not a valid image. What I
am doing wrong?

this is my code...

using System;
using System.Data.SqlClient;
using System.IO;

namespace nwTestCS
{
   class Program
   {
       static void Main(string[] args)
       {
           using (SqlConnection connection = new
SqlConnection(Properties.Settings.Default.dbStr)) {
               connection.Open();
               SqlCommand command = new SqlCommand("select photo from
Employees", connection);
               File.WriteAllBytes(@"C:\photo.jpg",(byte[])
command.ExecuteScalar());
           }
       }
   }
}

thanks! it worked
.



Relevant Pages

  • Re: NorthWind Database, cant view images
    ... In the Northwind datatabase are Ole bytes array included. ... To get the images you need an offset of 78 bytes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: how does your language... make a map?
    ... Again, storing the map ... push(array,element) just appends the element to the array. ... Int is the standard integer type, which leaves MapCell (a data type) ... data MapCell(Terrain terrain, Occupant occupant); ...
    (rec.games.roguelike.development)
  • Re: Doc/View question
    ... elements in the array to get how many bytes of stack space it requires. ... sequence of bytes that is long enough to hold the entire contents of the array. ... data type" for this purpose! ... So then it appears that I can put structs of different member types into CArray ...
    (microsoft.public.vc.mfc)
  • Re: Array descriptors
    ... There seem to be two ways of implementing the array descriptors ("dope ... where the base_address plus the offset defines the first memory ... Sun Fortran uses a third option. ... origin, your base address, and a virtual origin, the address ...
    (comp.lang.fortran)
  • Re: fast dictionary search algorithm
    ... >> requested word's meaning in the shortest time possible. ... >Im no expert but I would have thought a binary search for a hash from ... using it as an array offset. ...
    (comp.programming)