Re: NorthWind Database, can't view images
- From: JP <j.pabloblanco@xxxxxxxxx>
- Date: Sun, 1 Jun 2008 08:14:46 -0700 (PDT)
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
.
- References:
- NorthWind Database, can't view images
- From: JP
- Re: NorthWind Database, can't view images
- From: Cor Ligthert[MVP]
- NorthWind Database, can't view images
- Prev by Date: ScrollBar and TrackBar difference
- Next by Date: Re: Cascade delete with Linq To SQL
- Previous by thread: Re: NorthWind Database, can't view images
- Next by thread: Re: Memory mapping
- Index(es):
Relevant Pages
|